andyedinborough / aenetmail

C# POP/IMAP Mail Client
370 stars 153 forks source link

MailMessage Save not saving all the data #116

Closed 537mfb closed 11 years ago

537mfb commented 11 years ago

When using MailMessage Save, some items are not beeing saved

Where you have

txt.WriteLine("To: ", string.Join("; ", To.Select(x => x.ToString())));
txt.WriteLine("Cc: ", string.Join("; ", Cc.Select(x => x.ToString())));
txt.WriteLine("Reply-To: ", string.Join("; ", ReplyTo.Select(x => x.ToString())));
txt.WriteLine("Bcc: ", string.Join("; ", Bcc.Select(x => x.ToString())));
if (Sender != null)
    txt.WriteLine("Sender: ", Sender);
if (From != null)
    txt.WriteLine("From: ", Sender);
if (!string.IsNullOrEmpty(MessageID))
    txt.WriteLine("Message-ID: ", MessageID);

You should have

txt.WriteLine("To: {0}", string.Join("; ", To.Select(x => x.ToString())));
txt.WriteLine("Cc: {0}", string.Join("; ", Cc.Select(x => x.ToString())));
txt.WriteLine("Reply-To: {0}", string.Join("; ", ReplyTo.Select(x => x.ToString())));
txt.WriteLine("Bcc: {0}", string.Join("; ", Bcc.Select(x => x.ToString())));
if (Sender != null)
    txt.WriteLine("Sender: {0}", Sender);
if (From != null)
    txt.WriteLine("From: {0}", Sender);
if (!string.IsNullOrEmpty(MessageID))
    txt.WriteLine("Message-ID: {0}", MessageID);

Notice the missing {0}' s in your code

andyedinborough commented 11 years ago

Wow... I can't believe I did that. I'll update it now. Thanks!

537mfb commented 11 years ago

Happens to us all Just noticed one more oops on the same code

Where you have

if (From != null)
    txt.WriteLine("From: {0}", Sender);

You should have

if (From != null)
    txt.WriteLine("From: {0}", From);