We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Emails are not getting deleted (mark as read) from GMail using Pop3Client

Hi Team,
We have faced with situation when some emails are not getting deleted (or marked as read by Aspose) from GMail account using POP3 protocol. This behavior we can reproduce only our customer end. So I uploaded email, end of session’s screenshot. We use 19.5 version, but it seems like this problem is missing at least in the latest version of Aspose 19.11…
So the question is do you know about this problem?
If so what the cause of this problem was?

I’ve uploaded archive with screenshot and email: AsposeForum.zip (489.3 KB)

Steps to reproduce:

  1. Forward email to gmail account.
  2. Receive email using Aspose’s POP3 client
  3. We’re getting a loop forever because emails aren’t mark as read

SourceCode:
string outputPath = ConfigurationManager.AppSettings[“OutputPath”];

            var pop3ClientConnection = new Pop3Client();
            var msgCount = 0;
            List<string> messagesIDs = new List<string>();

            try
            {
                pop3ClientConnection.Host = host;
                pop3ClientConnection.Port = 995;
                pop3ClientConnection.Username = user;
                pop3ClientConnection.Password = psw;
                pop3ClientConnection.SecurityOptions = SecurityOptions.SSLAuto;
                pop3ClientConnection.UseDefaultCredentials = useDefCred;
                
                msgCount = pop3ClientConnection.GetMessageCount();

                for (int i = 1; i <= msgCount; i++)
                {
                    messagesIDs.Add(pop3ClientConnection.GetMessageUniqueId(i));
                }

                foreach (var messagesID in messagesIDs)
                {
                    Aspose.Email.MailMessage msg = pop3ClientConnection.FetchMessage(messagesID);

                    if (msg.BodyType == BodyContentType.PlainText)
                    {
                        msg.Save(outputPath + messagesID + "Msg.msg", SaveOptions.DefaultMsg);
                    }
                    else if (msg.BodyType == BodyContentType.Html)
                    {

                        using (MemoryStream ms = new MemoryStream())
                        {
                            HtmlSaveOptions htmlSaveOption = new HtmlSaveOptions();

                            htmlSaveOption.HtmlFormatOptions |= HtmlFormatOptions.WriteHeader |
                                                                HtmlFormatOptions.WriteCompleteEmailAddress |
                                                                HtmlFormatOptions.WriteCompleteCcEmailAddress;

                            htmlSaveOption.CheckBodyContentEncoding = true;
                            msg.Save(ms, htmlSaveOption);

                            File.WriteAllBytes(outputPath + "output.htm", ms.ToArray());
                        }
                    }

                    pop3ClientConnection.DeleteMessage(messagesID);
                    pop3ClientConnection.CommitDeletes();
                }
            }
            catch (Exception e)
            {
                return "Houston we have a problem..  " + e;
            }

@cap.aspose,

I have observed the issue shared by you. I have read your following comments:

You mean to say that issue is not getting reproduced using latest version. If you are unable to reproduce the issue using latest version then we not consider this to be an issue. Can you please confirm.

Hi
I suggest the problem has been resolved since 19.11 patch… But it’s difficult to understand for me if it was so… because we cannot reproduce it in our environment (only in customer’s end).

@cap.aspose,

I am sorry, I couldn’t understand the your comments. If with latest version the issue is reproduced on your end or not? I am unable to understand your following comment too:

Hi,
I hope you read carefully my first comment because I said this behavior we can reproduce only in our customer’s environment.

Today it seems the latest version of Aspose.Email works fine. I’ve asked you to clarify if did you know about this issue and attached .zip with screenshot from wireshark’s, email and piece of code…

Thanks

@cap.aspose,

I like to share that we have not investigated the issue on our end since it is not reproduced using latest version. If it were reproduced using latest version then we could have investigated it further on our end.