在向smtp server发送以下命令时
mail from:<[email protected]>
rcpt to:<[email protected]>
data
Cc:<[email protected]>
怎样才能让Cc:<[email protected]>作为电子邮件的内容发送,而不是作为头发送?
mail from:<[email protected]>
rcpt to:<[email protected]>
data
Cc:<[email protected]>
怎样才能让Cc:<[email protected]>作为电子邮件的内容发送,而不是作为头发送?
To: [email protected]
Subject: subject
Cc: [email protected]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bitmessage.setText(content+"Cc: "+CC);//其中的CC是你邮件的超送地址。
outToServer.writeBytes("HELO" + hostname + "\n");
outToServer.writeBytes("mail from:<" + from + ">\n");
outToServer.writeBytes("rcpt to:<" + recipient + ">\n");
outToServer.writeBytes("data\n");
outToServer.writeBytes(data);之前把data赋值为
Cc:<[email protected]>
this is test我想让收件人查看邮件时Cc:<[email protected]>和this is test都显示在邮件内容中,而不是Cc:出现在header中,this is test出现在content中。如果想实现的话应该怎样改data中的内容的格式?
outToServer.writeBytes(" "+"\n");
outToServer.writeBytes("rcpt to:<" + recipient + ">\n");
在它们之间加入一个空行和一些空格,你在试试看怎么样。我也在做89496823
我在rfc2822中看到这样一段,我觉得是用来解决这个问题的,可是怎么试也不行
哪位高手能帮助解决一下?
3.2.2. Quoted characters Some characters are reserved for special interpretation, such as
delimiting lexical tokens. To permit use of these characters as
uninterpreted data, a quoting mechanism is provided.quoted-pair = ("\" text) / obs-qp Where any quoted-pair appears, it is to be interpreted as the text
character alone. That is to say, the "\" character that appears as
part of a quoted-pair is semantically "invisible". Note: The "\" character may appear in a message where it is not part
of a quoted-pair. A "\" character that does not appear in a
quoted-pair is not semantically invisible. The only places in this
standard where quoted-pair currently appears are ccontent, qcontent,
dcontent, no-fold-quote, and no-fold-literal.
outToServer.writeBytes("\"("rcpt to:<" + recipient + ">\n")/obs-qp);