Subject: System.ArgumentOutOfRangeException, Download Email
Date: 2014-08-18 11:23:47
From: Iris Maag
Source: system-argumentoutofrangeexception-download-email
----------------------------------------------------------------------

Hi,

We are using the Mail-DLL for downloading Emails. But in the new Version, we have an Exception:

[code]15.08.2014|08:34:04,544|ERROR|System.ArgumentOutOfRangeException: Argument is out of range of valid values. It must be in a range from 1 to 2147483647.
Parameter name: messageInboxIndex
Actual value was 0.
at ComponentPro.Net.Mail.Pop3.DownloadMailMessage(Int32 messageInboxIndex)
at supplierportal.FetchMail.getMailsPop3()|| [/code]

We use the code from your Example (http://www.componentpro.com/doc/mail/Downloading-a-message-Synchronously.htm), but pop3Message.MessageInboxIndex is always 0.

Is there a workaround for downloading the Email ?

 

Our code:

[code lang='c#']

           Pop3MessageCollection list = new Pop3MessageCollection();
            try
            {
                list = client.ListMessages(Pop3EnvelopeParts.Size | Pop3EnvelopeParts.UniqueId);
            }
            catch (Exception ex)
            {
                _log.Error("Could not download Emails. Error: ");
                _log.Error(ex);
                throw ex;
            }
          

for (int i = 0; i < list.Count; i++)
 {
                Pop3Message pop3Message = list[i];
                // Download the message to an instance of the MailMessage class.
                MailMessage Email = null;

                try
                {
                    Email = client.DownloadMailMessage(pop3Message.MessageInboxIndex);
                }
                catch(Exception ex)
                {
                    _log.Error("DEB_FM_033_1: Fehler beim Email runterladen !");
                    _log.Error(ex);
                    continue;
                }
               .........

                  

                }
                else
                {

                    if (_log.IsDebugEnabled)
                        _log.Debug("DEB_FM_033: Email ist null, konnte nicht gespeichert werden");
                }
                
 }
            client.Disconnect();

[/code]

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index