在向smtp server发送以下命令时
mail from:<[email protected]>
rcpt to:<[email protected]>
data
Cc:<[email protected]>
怎样才能让Cc:<[email protected]>作为电子邮件的内容发送,而不是作为头发送?

解决方案 »

  1.   

    我的意思是,收件人收到邮件后,Cc:<[email protected]>要出现在邮件内容中,而不应该和From:和To:一样出现在header中。
      

  2.   

    From: tsg <[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是你邮件的超送地址。
      

  3.   

    我现在只是用socket和smtp服务器连接,然后
    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中的内容的格式?
      

  4.   

    outToServer.writeBytes("mail from:<" + from + ">\n");
    outToServer.writeBytes("  "+"\n");
    outToServer.writeBytes("rcpt to:<" + recipient + ">\n");
    在它们之间加入一个空行和一些空格,你在试试看怎么样。我也在做89496823
      

  5.   

    好像不行,outToServer.writeBytes("  "+"\n");后socket返回Unrecognised command。
    我在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.
      

  6.   

    是这样修改的吗??
    outToServer.writeBytes("\"("rcpt to:<" + recipient + ">\n")/obs-qp);