This project is read-only.

Base 64 Execption While Fetching Mails

Sep 13, 2012 at 9:11 AM

i m getting execption while fetching mails-


The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. 


plz chk that problem .

( i think it happens if The DISPLAY NAME  Contains more than two words . its just our guess.)

plz help us waiting for u r great help.:)

Sep 13, 2012 at 9:25 AM
Edited Sep 13, 2012 at 9:38 AM

I'll fix it, but it would be easier to figure out, if you could send me a test message to

Same as you're testing your code with and receive this exception

Sep 13, 2012 at 9:39 AM

sorry but we dont have permisstion to sent email which we r useing.

but according to use getting problem in TO field in which Display Name is in three words

abc pqr xyz < >

plz chk it


Sep 13, 2012 at 6:47 PM

This exception can only occure (and is not being caught on the library level) in the message body parsing, when you call the GetDecodedBody method. So without having the exact body content for the message, i can't fix it.

Sep 14, 2012 at 6:18 AM
Edited Sep 14, 2012 at 6:28 AM

sorry i m getting error from follwoing line




ImapX.MessageCollection emails = client.Folders["INBOX"].Search(query, true);




Sep 14, 2012 at 9:07 AM
Edited Sep 14, 2012 at 10:22 AM

If you report any exceptions, please always provide a detailed stacktrace. A line of YOUR code doesn't say anything out about what happens inside the library. I'm sorry, but I'm not a fortune-teller.

I'll go through the code to see what happens, but to really fix it, I need at least a stacktrace.

If you can also provide a test message on which the exception occurs, it would be perfect.

You can use the smaple application to get the stacktrace. It's provided on all unhandled exceptions

Sep 14, 2012 at 11:04 AM
Edited Sep 14, 2012 at 12:31 PM

chk follwoing SS

Sep 14, 2012 at 11:34 AM
Edited Sep 14, 2012 at 11:35 AM

plz chk img and solve it plz

Sep 14, 2012 at 11:54 AM
Edited Sep 14, 2012 at 11:58 AM

The error occurs when trying to parse an attachment. Could you send me the attachement included into your message to or tell me more about it?

Also: the code that is responsible for the attachment parsing was updated yesterday, make sure you have the latest version of the library

Sep 14, 2012 at 12:18 PM
Edited Sep 14, 2012 at 12:29 PM

ok but that screenshot taken just few min ago. and also downloaded u r latest sample app few min ago . but getting same err and u r seen that error screen shot





and that email contains lot of emails . how we come to know in whic email we get error? any idea?

Sep 14, 2012 at 12:59 PM

I updated the sample application (binaries) to provide more details on this error. Now, you'll get an error dialog with all required details. Please copy the exception details provided in this dialog to a text file, and send it to


Sep 14, 2012 at 1:08 PM

ok thanks will chk n reply

May 1, 2013 at 5:38 PM
I have the same issue. It happens if I have excel attachment (not all cases). I've downloaded latest version ImapX ( but still I get error message.

Here is my code:
            _messages = folder.Messages.ToList(); 

            foreach (var message in _messages)
                message.Process();  //I get error on this line if there Excel file attachment (as I mentioned before it happens just in some cases)
                MailMessage mailMessage = PopulateMailMessage(message);
                if (mailMessage != null)
                    mailMessage = CheckIfNeedsToReportError(mailMessage);
May 2, 2013 at 12:37 AM
Edited May 2, 2013 at 12:41 AM
Hi sirous70,

I updated the source code in the repository today, the latest changes contain many fixes for attachment parsing. Can you check if you still experience the issue using the source code from the repository?

If so, would ask you to provide some test credentials, so I can debug the code and see when the error occurs. You can send them directly to me: .

Best regards,

Pavel Azanov
May 2, 2013 at 11:40 AM
sirous70, please do not send duplicate posts. The answer is above this message.