If you are talking about this sample:
using(Imap imap = new Imap())
{
imap.Connect("imap.server.com"); // or ConnectSSL for SSL
imap.UseBestLogin("user", "password");
imap.SelectInbox();
List<long> uids = imap.Search(Flag.Unseen);
foreach (long uid in uids)
{
IMail email = new MailBuilder()
.CreateFromEml(imap.GetMessageByUID(uid));
Console.WriteLine(email.Subject);
}
imap.Close();
}
... and this line specifically:
Console.WriteLine(email.Subject);
you can simply create a local variable:
string subject = email.Subject;
To access email body you can use following properties/methods:
- IMail.Text - gets plain text version of this email message.
- IMail.Html - gets HTML version of this email message.
- IMail.GetBodyAsText() - returns body in plain text format. Performs email HTML/RTF to text conversions when needed.
- IMail.GetBodyAsHtml() - returns body in HTML format. Performs email text to HTML conversions when needed.