Subject: Gettiing message body issues
Date: 2010-09-15 20:24:29
From: chris barney
Source: gettiing-message-body-issues
----------------------------------------------------------------------

I have an interesting issue getting message body text using the BounceResult  class.   The issue is I can read body text from some bounce notification emails  - but not others.   I am using an Guid included in the sent emails as a reference id to write back statuses to a database and need to get the original message text to extract the Guid.  
                                                  
All email is sent in the same manner with the following delivery notification properties set as shown:

smtpClient.DeliveryStatusNotificationReturnMessageMethod
      =   DeliveryStatusNotificationReturnMessageMethod.FullMessage;
smtpClient.DeliveryStatusNotificationType
      = DeliveryStatusNotificationType.All;

Here is the code I am using to read the original message texts:

  foreach (BounceResult r in result)
                {
                    if (r.Identified)
                    {
                        string messageId = "none found";
                        foreach (Attachment at in r.MailMessage.Attachments)
                        {
                            if ( at.Message != null )
                            {
                                string bodyText = at.Message.BodyText;
                                // extract message id
                                int regIndex = bodyText.IndexOf("ref:",StringComparison.CurrentCulture);
                                messageId = bodyText.Substring(regIndex + 4, Guid.Empty.ToString().Length);
                             }
                        }
                       // Update message status....
                    }

For the email bounce notification messages that I can read the bodyText there is Dsn.Action and  Dsn.DiagnosticCode information.  For the emails that do not have bodyText there is no DDsn.Action orDsn.DiagnosticCode information.

I am using UltimateEmail trial edition at the moment and have the full-source corporate licensed version ordered.

I am using gmail as a development imap server.

More Info:

The mail bounce messages that I can read the bodyText from are those that are sent to existing domains in which the recipient does not exist.  The ones I cannot read the bodyText from are sent to nonexistent domains. 


Thanks
chris

                                   ---------------------------------------------------------------------- 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