+3 votes

Hi i need your help if possible.
i use your example to reply to emails.
my problem is that your example searches to find the "iMail" object from the mailbox.

in my scenario i save every property of each email to my db (now raw email but properties values)

so in case the original email doesn't exist any more in the mailbox , how can i create an original email from my DB stored values

Thanks in advance


1 Answer

0 votes

If you don't have the original email as raw eml data, you won't be able to recreate it precisely.

To create a correct reply you need to have an IMail instance representing original email. You can use MailBuilder class to re-create it so it at least resembles the original.

MailBuilder originalEmailBuilder = new MailBuilder();
originalEmailBuilder.Subject = "subject";
originalEmailBuilder.MessageID = "message-id";
originalEmailBuilder.From.Add(new MailBox("original-from@example.com"));
originalEmailBuilder.To.Add(new MailBox("original-receipient@example.com"));
originalEmailBuilder.Text = "original text";

IMail original = originalEmailBuilder.Create();

ReplyBuilder replyBuilder = original.Reply();
replyBuilder.Html = "this is the <strong>reply</strong>";

var from = new MailBox("original-receipient@example.com");
MailBuilder builder = replyBuilder.Reply(from);

IMail reply = builder.Create();
by (298k points)
what about gmail threadid?