0 votes

Context : Mail.dll 3.0.21294.1630, licensed release

I'm trying to get messages from Exchange mailbox that contains corrupted email with Pop3 components.

Unfortunately, the program raises "MESSAGE CORRUPTED" exception (Pop3ResponseException)., although that I can correctly open those messages with Outlook.

const string K_Server = "outlook.office365.com";
const string K_eMail = "test@test.com";   
const string K_Password = "xxxxxxxxxxxx"; 

    using (Pop3 pop = new Pop3())
        pop.ConnectSSL(K_Server, 995);
        pop.Login(K_eMail, K_Password);
        List<string> uids = pop.GetAll();
        MailBuilder builder = new MailBuilder();
        foreach (string s in uids)
            byte[] data = pop.GetMessageByUID(s);
            IMail iMail = builder.CreateFromEml(data);
catch (Exception)

Any help would be nice. Thanks.

by (310 points)

1 Answer

+1 vote

If you are getting Pop3ResponseException it means that the error is raised on the server and is only returned to the client (Mail.dll).

Looks like Outlook's POP3 service can not access/parse this message and is not even able to return it to the client.

There's nothing you can do with this to be honest, except maybe opening a ticket or contacting your administrator.

You may try accessing this message through IMAP instead of POP3.

by (298k points)
What I do not understand, is why Outlook client can open those corrupted mail.
I think I'll try IMAP connection, but it may "not" work same as POP3.
Outlook is not using POP3/IMAP internally. It is connecting to exchange with some proprietary protocol. Also Exchange is not storing messages in the raw MIME format internally.

Is there a way to get and save data of so corrupted mails to standard file (eg.) ?

Unfortunately this is a server side error. Server doesn't return any data. There's nothing you could save.

I'd try using IMAP. Code would be almost exactly the same.