This project is read-only.

Unable to Fetch mail with special characters in header


I am trying to Fetch mails from gmail Inbox. I am using the below code:

Imap4Client _client = null;
        _client = new Imap4Client();

        _client.ConnectSsl("", 993);
        _client.Login("", "xxxxx");

        Mailbox mails = _client.SelectMailbox("Inbox");

        int[] messageIDs = mails.Search("ALL");

        for (var i = 0; i < messageIDs.Length; i++)

            ActiveUp.Net.Mail.Message message = mails.Fetch.MessageObject(messageIDs[i]);
In that particular email, the below special characters [/O=,/,, ,] are there in the CC address:
cc: "MOHAMMED__ASHRAF <,/,, ," <>

Please advise how to read such email or how to check if any special characters are there in the header.

I tried to Fetch the header only instead of fetching the whole message using the below code:
            string strHeader =  mails.Fetch.HeaderString(i);

            Header header = mails.Fetch.HeaderObject(i);
But this code also giving the error [Command "fetch 0 rfc822.header" failed : 160329085402493 BAD Could not parse command] for the first message in the inbox.

Thank you,


jstedfast wrote Mar 30, 2016 at 9:09 PM

Unfortunately MailSystem.NET is a dead project. You might have better luck using MailKit instead.

diya wrote Mar 31, 2016 at 6:38 AM

Thank you jstedfast for your reply. Indeed this was my collegue's code written long back handed over to me for support. Actually my customer is using Domino which I don't have. So I am using gmail to reproduce the same issue. Any suggestions on reading Domino's inbox please?

jstedfast wrote Mar 31, 2016 at 6:26 PM

If it's an IMAP server, it should be no different from any other IMAP server.