Reputation: 1985
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("[email protected]");
replyto.What? = recievedmessage ID? (wich I get from my Imap Library)
replyto.Headers["whatgoeshere"] = recievedmessage ID? (wich I get from my Imap Library)
Upvotes: 1
Views: 965
Reputation: 38593
To start with, the reply message should do the following things (which are all convention more than anything else):
To
header should be set to the original message's Reply-To
value, if set, otherwise to the From
value.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).In-Reply-To
header should be set to the original message's Message-Id
header value.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.
Upvotes: 2
Reputation: 867
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.
Upvotes: 0