I have a question regarding downloading attachments using the ImapX library for C#. I am trying to download the XML attachments , but when it reaches the MessageCollection line i get a “Cannot convert Base64 string” error. This only occurs when there is actual XML in the file (as opposed to a dummy XML file). Is there any way to fix this issue? I am very keen on using the ImapX library as it is the best i’ve come across.
ImapX.ImapClient client = new ImapX.ImapClient("imap.gmail.com", 993, true);
bool result = false;
result = client.Connection();
if (result)
Console.WriteLine("Connection Established");
result = client.LogIn(Username, Password);
if (result)
{
//try
//{
Console.WriteLine("Logged in as: " + Username);
//FolderCollection folders = client.Folders;
MessageCollection messages = client.Folders["INBOX"].Search("UNSEEN", true); //true - means all message parts will be received from server
foreach (ImapX.Message m in client.Folders["INBOX"].Messages)
{
SOLVED: I have managed to solve my issue by changing the encoding of the xml file to unicode. The issue i found is that ImapX does not like “