Dear All,
Good Day
I am using the latest version of the imapx dll in order to read the unread message from inbox using the below code:
using(var client = new ImapClient("abc.def.com", 993, true, false))
{
if (client.Connect())
{
if (client.Login("abcd@abc.com", "abc123"))
{
//client.Behavior.ExamineFolders = false;
//client.Behavior.FolderTreeBrowseMode = FolderTreeBrowseMode.Lazy;
//client.Behavior.MessageFetchMode = MessageFetchMode.Tiny;
client.IsDebug = true;
Folder folder = client.Folders.Inbox;
//folder.Examine();
var messages = folder.Search("UNSEEN", MessageFetchMode.Minimal);
foreach (var mess in messages)
{
mess.Seen = true;
Console.WriteLine(mess.Subject);
Console.WriteLine(mess.Body.Text);
Console.WriteLine(mess.From);
}
client.Logout();
client.Disconnect();
}
else
{
throw new Exception("Cannot login to IMAP Server.");
}
}
else
{
throw new Exception("Cannot connect to IMAP Server.");
}
}
when the line:
var disposition = new ContentDisposition(type);
executes, i get the exception: 'An invalid character was found in the mail header: ','."'
also get the format error exception when there is embedded image inside the message body.
Kindly check the same and revert in case i am doing anything wrong here. Since i am using this library for the first time please dont mind if there is a silly mistake.
Thanks in advance,
Durga Charan
Good Day
I am using the latest version of the imapx dll in order to read the unread message from inbox using the below code:
using(var client = new ImapClient("abc.def.com", 993, true, false))
{
if (client.Connect())
{
if (client.Login("abcd@abc.com", "abc123"))
{
//client.Behavior.ExamineFolders = false;
//client.Behavior.FolderTreeBrowseMode = FolderTreeBrowseMode.Lazy;
//client.Behavior.MessageFetchMode = MessageFetchMode.Tiny;
client.IsDebug = true;
Folder folder = client.Folders.Inbox;
//folder.Examine();
var messages = folder.Search("UNSEEN", MessageFetchMode.Minimal);
foreach (var mess in messages)
{
mess.Seen = true;
Console.WriteLine(mess.Subject);
Console.WriteLine(mess.Body.Text);
Console.WriteLine(mess.From);
}
client.Logout();
client.Disconnect();
}
else
{
throw new Exception("Cannot login to IMAP Server.");
}
}
else
{
throw new Exception("Cannot connect to IMAP Server.");
}
}
when the line:
var disposition = new ContentDisposition(type);
executes, i get the exception: 'An invalid character was found in the mail header: ','."'
also get the format error exception when there is embedded image inside the message body.
Kindly check the same and revert in case i am doing anything wrong here. Since i am using this library for the first time please dont mind if there is a silly mistake.
Thanks in advance,
Durga Charan