문제

I am creating a WebMail client, but I have a question.
Sending mails are easy if just using SMTPClient, but how would I send a reply, for example if the user decides to reply to a message, Is it just basically copy the old body and append it to the new body that I am going to send or what is the better way to reply to a message

So what I bassicly want to do is

MailAddress replyto = new MailAddress("reply@whosoever.something");
replyto.What? = recievedmessage ID? (wich I get from my Imap Library)
replyto.Headers["whatgoeshere"] = recievedmessage ID? (wich I get from my Imap Library)
도움이 되었습니까?

해결책

To start with, the reply message should do the following things (which are all convention more than anything else):

  1. The replied message's To header should be set to the original message's Reply-To value, if set, otherwise to the From value.
  2. The reply message's Subject header should be set to the value of the original message's Subject header, but with a "Re: " prefix (unless it already has one).
  3. The reply message's In-Reply-To header should be set to the original message's Message-Id header value.
  4. The reply message's References header should be set to the original message's References header value with the original message's Message-Id value appended to it.

That takes care of the headers. For the message body, that will depend on whether the message body you are replying to is in text/plain or text/html format.

Since there's no real convention for text/html messages, I'll explain the convention for text/plain replies instead.

Normally, what you do, as the author of an email client is to construct a default reply text body in the following format:

On ${TIMESTAMP}, ${AUTHOR_NAME} wrote:

followed by the original message text with each line prefixed with "> " (greater-than space).

Depending on the mail client, the ${TIMESTAMP} string will be formatted differently, but it'll often be more-or-less the same format as the original message's Date header.

The author's name, of course, is taken from the parsed email address in the From header.

If you are auto-generating a reply to a message, it'll probably easiest to prepend the reply text to the "quoted" original message body text (which is often referred to as top-posting), but there are other styles that some people use when replying manually.

다른 팁

In my experiences it's up to you as long as the new message is properly formatted according to the SMTP RFC you're free to do what you want. SMTP is essentially a relay agent, not a mail sevrer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top