Free Support Forum - aspose.com

Aspose email gives an error but we do not understand what is wrong

Hello,

We use aspose email to send mail to the customer. Most of the times this works ok, but sometiimes we get a Email error from the aspose code where we can not do anything with( the call stack does not give a clue what is wrong).

The following samples of the call stacks are available:
xception 2020-11-12 20120070
Message Failure sending mail
Type AsposeException
ExceptionData
Version 100143930
Source AsposeEmail
Target SystemObject zk7dZIe0SystemIAsyncResult)
InnerException
InnerMessage Failure sending mail
StackTrace inner) at zmCKQgQFM6xSC9QQcSD1HyMskt9t8IXm682PyS8zH5a2QLM)
at zmCKQgQFM6xSC9QQcSD1HyMskt9t8IXm682PyS8zAyDj7wg)
at zemV0JXWiwVgki2VQMEEX50uywCHCr01VAz2HsEFrK6Lp5Y)end inner)

InnerException InnerMessage Value cannot be null
Parameter name boundary
StackTrace inner) at zg5bTvY8zALtvObMZZfz00QFLlD2ctorStream zb58svRo String zG6ThT4o String zmHonHzjn8fxI Int32 zLFl4rmZMmwy7)
at zJ9MFHo9VvYOGex3znSiHtO45IiBzYif43AzSQTmNupIXAVPzXEIQXpfRO2LcV0L zkkalS30 Boolean zyG3TgumYnRbF Boolean zfcoY0ipEPQR ProgressEventHandlerInfo zKq1Gi7w Action1 z1jMeSXIi8v)
at zUbGEupG5lJX5PIRPNQzYif43AzSQTmNupIXAVPzXEIQXpfRO2LcV0L zkkalS30 ProgressEventHandlerInfo zKq1Gi7w Action1 z1jMeSXIi8v)
at zmCKQgQFM6xSC9QQcSD1HyMskt9t8IXm682PyS8zH5a2QLMMailAddress zjG4716Q MailAddressCollection zSBkZRw37lhM80pt0Q MailMessage zAdVRtjw Stream zMfo7HFUSK3Cx)
at zmCKQgQFM6xSC9QQcSD1HyMskt9t8IXm682PyS8zH5a2QLM)end inner)
Callstack main) at zCaT13LiJ13UdPuRtfZj5aWvtDrzk7dZIe0IAsyncResult z4vJ7vFQ)
at zCaT13LiJ13UdPuRtfZj5aWvtDrzk7dZIe0)
at AsposeEmailClientsSmtpSmtpClientEndSendIAsyncResult asyncResult)
at AsposeEmailClientsSmtpSmtpClientSendIConnection connection IEnumerable1 messages)
at AsposeEmailClientsSmtpSmtpClientSendMailMessage message)
at LetterServiceMailsBasicSendMailOptionsCreateAndSendMailParseTemplateResult result Boolean isExcelFile CredentialsInfo credentials) in Da56sLetterServiceMailsSendMailOptionscsline 364
at LetterServiceOutputLibraryServiceParseWordTemplateForDataSetParseWordTemplateOptions input CredentialsInfo credentials) in Da56sLetterServiceLetterServiceasmxcsline 347end main)

second sample:
Exception <<< 2020-09-01 20:03:53:51 >>>>>>>>>>>>>>>>>>>>>
Message : Probleem bij ophalen gegevens:
Exception 2020-09-01 20035252
Message Failure sending mail
Type AsposeException
ExceptionData
Version 100143930
Source AsposeEmail
Target SystemObject zLOzLpWESystemIAsyncResult)
InnerException
InnerMessage Failure sending mail
StackTrace inner) at zAQYqvQ9f9aviccvY77gh5NeX4MnqU1aAlVw2i4zHsOdjUk)
at zAQYqvQ9f9aviccvY77gh5NeX4MnqU1aAlVw2i4zNimUadM)
at zFpyEVpcJTeOu98Koe38ZBPPATVBn9nskQzLHLXEXNf4Eo7)end inner)
InnerException InnerMessage Value cannot be null
Parameter name boundary
StackTrace inner) at zzTKoIIV9MaeQiWuNauvZVNiHk41ctorStream zrYpxzNU String zIrnK2GE String zzuxLc0UuiqGQ Int32 zlk5VuGZ2ckPX)
at zdfxkEZdNuFwIKmPoGdfqLNQiZF5kzctxejBMzg1UfzpuXpQWmOy3Bfj72qiFreIW zSw0OdK0 Boolean zJumigxALRM Boolean zCeqt5fg5Gr ProgressEventHandlerInfo zKUNXOik Action1 zDVvu3D5tZNai)
at zLHOWN3ofBHptjtUY6wzctxejBMzg1UfzpuXpQWmOy3Bfj72qiFreIW zSw0OdK0 ProgressEventHandlerInfo zKUNXOik Action1 zDVvu3D5tZNai)
at zAQYqvQ9f9aviccvY77gh5NeX4MnqU1aAlVw2i4zHsOdjUkMailAddress zFgTV0k MailAddressCollection zSxkbpsYfBBtXaQ1K1g MailMessage zRCA2418 Stream zoP72rCBLBTev)
at zAQYqvQ9f9aviccvY77gh5NeX4MnqU1aAlVw2i4zHsOdjUk)end inner)
Callstack main) at zFvkAL1ppD3n3BRx0FKg9E49oa8rPzLOzLpWEIAsyncResult zY1N8zI)
at zFvkAL1ppD3n3BRx0FKg9E49oa8rPzLOzLpWE)
at AsposeEmailClientsSmtpSmtpClientEndSendIAsyncResult asyncResult)
at AsposeEmailClientsSmtpSmtpClientSendIConnection connection IEnumerable1 messages)
at AsposeEmailClientsSmtpSmtpClientSendMailMessage message)
at LetterServiceMailsBasicSendMailOptionsCreateAndSendMailParseTemplateResult result Boolean isExcelFile CredentialsInfo credentials) in da56sLetterServiceMailsSendMailOptionscsline 347
at LetterServiceOutputLibraryServiceParseWordTemplateForDataSetParseWordTemplateOptions input CredentialsInfo credentials) in da56sLetterServiceLetterServiceasmxcsline 345end main)

The version of aspose email is: 20.9.1.0

Could you help us figure out which value is null in this case?
As the source code is further encrypted so that the function names won’t give us any clue.

Hope that you can help.

Regards,

René

@info.verne.nu

Can you please share the working sample project reproducing the issue on your end as you have shared that the issue is intermittent as well. Please provide the details that how we can reproduce the issue on our end. I also suggest you to please try using latest Aspose.Email for .NET 20.10 on your end.

Hi mudassir,

a sample of the code is supplied below:
internal byte[] CreateAndSendMail(ParseTemplateResult result, Core.CredentialsInfo credentials)
{
LoadMailLicense();
using (var resources = new StreamManager())
{
MailMessage message = null;

            /*  does not seem to have the desired effect, disabled for now.
            var hasPlainTextAlternative = false;
            foreach (var view in message.AlternateViews)
            {
                if (view.ContentType.MediaType == "text/plain")
                {
                    hasPlainTextAlternative = true;
                    break;
                }
            }

            if (!hasPlainTextAlternative)
            {
                var textView = AlternateView.CreateAlternateViewFromString(Properties.Settings.Default.PlainTextAlternativeToHtmlEmail);
                message.AddAlternateView(textView);
            }*/

            using (message)
            {
                message.Subject = Subject;
                AddToCollection(message.To, To);
                AddToCollection(message.CC, Cc);
                AddToCollection(message.Bcc, Bcc);
                AddToCollection(message.ReplyToList, ReplyToList);

                #region Fill 'sender' and 'from'
                // Prefer to use 'From' but use 'Sender' if it is not available
                if (From?.Address != null)
                {
                    message.From = From.Address;
                }
                else if (Sender?.Address != null)
                {
                    message.From = Sender.Address;
                }

                // Prefer to use 'Sender' but use 'From' if it is not available
                if (Sender?.Address != null)
                {
                    message.Sender = Sender.Address;
                }
                else if (From?.Address != null)
                {
                    message.Sender = From.Address;
                }
                #endregion

                var config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
               
                SmtpClient mailerConstructor;

                lock (ThreadSafeConstructorLock)
                {
                    mailerConstructor = new SmtpClient(config);
                }
                using (var mailer = mailerConstructor)
                {
                    // Allow for sending of common 'special' characters link 'é' and '€'
                    message.SubjectEncoding = System.Text.Encoding.UTF8;
                    AddAttachments(credentials, resources, message);
                    **mailer.Send(message);**

                    var saveStream = resources.CreateByteStream(null) as MemoryStream;
                    message.Save(saveStream, SaveOptions.DefaultMhtml);
                    return saveStream.ToArray();
                }
            }
			}

The function mailer.Send goes into the aspose code and then the code is Obfuscated. Inside this code sometimes it goes wrong but the error is not indicated what is wrong. (We send 10.000 emails per day. 99.x% of those email with this code work fine, however <1% is returning this error.).
My question is to understand what that error is, and how that we solve the problem.
Upgrading to 20.10 is not possible at the moment because it wil take at least 4 weaks for the customer to approve the software upgrade.

Hope that you can help me with getting the not Obfuscated aspose code (so that we can understand where the mail code is going wrong).
Regards,
René

@info.verne.nu

I have tried to get idea about issue from shared elaboration. Unfortunately, by using current information we may not reproduce the issue and request you to please share the working sample project reproducing the issue.

Hi Mudassir,

I extracted a sample of the production code with the same steps in it.
You have to change your smtp server in de the config to be able to send the mail message.
As I already told you in production the code is working > 99% on in a few cases we get a internal aspose error when sending the mail with smtp. If we try the same message later in time it normally is accepted without any error.

Hope that we can found out what the internal error could be.

Regards,

RenéAsposeMail.zip (4.3 MB)

@info.verne.nu

We are verifying the issue on our end and will share the feedback with you as soon as possible.

@info.verne.nu

I have created an issue with ID EMAILNET-39978 in our issue tracking system to further investigate the issue on our end. We will share the feedback with you as soon as the investigation will be completed.

Hi Mudassir,
Great that you have recorded the issue. Can you give a time span when there will be an answer what the
zzTKoIIV9MaeQiWuNauvZVNiHk41ctorStream obviscated function does?

Regards,

René

@info.verne.nu

The good news is that your issue has been marked as fixed for Aspose.Email for .NET 20.12. We request for your patience and will share the good news with you as soon as the product will be shared online.