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é

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

Hi Mudassir,
Thank you fro fixing the problem. Is there a timeline when the 20.12 will be released?

Regards,

René

@info.verne.nu

The said release will be available online by end of this month hopefully. We will share the release notification with you as soon as it will be made available online.

The issues you have found earlier (filed as EMAILNET-39978) have been fixed in this update.

Hi Mudassir,

we installed version 20.12 in production but there we randomly got the same error again.
So can you tell me what you did to solve item: EMAILNET-39978

The new callstack look like this:
Failure sending mail

StackTrace inner)
at zBUuAeXTntfCyPhjuW0vji67P0ag vmR5mtSJp54 zXBR4eiI )
at zBUuAeXTntfCyPhjuW0vji67P0ag vmR5mtSJp54 zhcjEo7w )
at zijUlNlatNZx58k3PRf33r09hrnOsXR847w ze0v3j7ALhy9t )
end inner)

InnerException

InnerMessage Value cannot be null

Parameter name boundary
StackTrace
inner)
at z6N7Xe Z ZRJRpULljTs V412YAEC ctor Stream zpwZLie8 String zCd4bDAQ String zHpe4GaT04Rth Int32 zBLnhfcjZo KY)
at zhIVQSdGNS34NUAiZexYk5Wsx5Jhw zv6BIexk z2h4SFPJHBIoeM3Mc8Y5gmjpIaM9O zEpu0nrQ Boolean z34D8FFExknc1 Boolean z8zYPQxGw8eHV ProgressEventHandlerInfo zVC5edRk Action 1 zWX3LFLywpcMo)
at zhIVQSdGNS34NUAiZexYk5Wsx5Jhw zv6BIexk z2h4SFPJHBIoeM3Mc8Y5gmjpIaM9O zEpu0nrQ Boolean z34D8FFExknc1 Boolean z8zYPQxGw8eHV ProgressEventHandlerInfo zVC5edRk Action 1 zWX3LFLywpcMo)
at zksu0TSzA5zDv8IbwcA zv6BIexk z2h4SFPJHBIoeM3Mc8Y5gmjpIaM9O zEpu0nrQ ProgressEventHandlerInfo zVC5edRk Action 1 zWX3LFLywpcMo)
at zBUuAeXTntfCyPhjuW0vji67P0ag vmR5mtSJp54 zXBR4eiI MailAddress zThZG 4E MailAddressCollection zi7TKLX7Gbac yTnaZw MailMessage znaqM7FQ Stream zV1C2l4tK5rfU)
at zBUuAeXTntfCyPhjuW0vji67P0ag vmR5mtSJp54 zXBR4eiI )
end inner)

Callstack
main)
at z2jS6ZhsmHo A5W aWRLDc4pzfCLF zAtCLYNc IAsyncResult zApOEgTw )
at z2jS6ZhsmHo A5W aWRLDc4pzfCLF zAtCLYNc )
at Aspose Email Clients Smtp SmtpClient EndSend IAsyncResult asyncResult)
at Aspose Email Clients Smtp SmtpClient Send IConnection connection IEnumerable 1 messages)
at Aspose Email Clients Smtp SmtpClient Send MailMessage message)
at LetterService Mails BasicSendMailOptions CreateAndSendMail ParseTemplateResult result Boolean isExcelFile CredentialsInfo credentials) in D a 56 s LetterService Mails SendMailOptions cs line 368
at LetterService OutputLibraryService ParseWordTemplateForDataSet ParseWordTemplateOptions input CredentialsInfo credentials) in D a 56 s LetterService LetterService asmx cs line 416
end main)

The last readable line is: at Aspose Email Clients Smtp SmtpClient EndSend IAsyncResult asyncResult)
After that the code is obvisicated so i cant see what is going one.
Hope that you can fix this issue.
Regards,

René

@info.verne.nu

I have associated the shared feedback in our issue tracking system and will share the feedback with you once the issue will be addressed.

@info.verne.nu

We have built a special DLL with some changes that may help you. Can you please try using the shared DLL on your end and provide your feedback.

Aspose.Email.dll.zip (3.6 MB)

Notes: Earlier, you have provided a non-working code, so we cannot test it and guarantee the correct working of our fixes. If the problem is not resolved please share the working code that compiles and works.

Hi mudassir,

thank you for the quick response. We are going to install the version on the production server en let you know the result. (I need some approval of the customer for that, it may take a few days to get the results).

Regards,

René

@info.verne.nu

Thank you for the feedback and please ensure following when you share back your feedback.

Hi mudassir,

We installed the version on the production environment and cached the call stack.
below are the two callstack traces available.

it still goes wrong on the function: at Aspose Email Clients Smtp SmtpClient EndSend IAsyncResult asyncResult)

Hopefully you see something that can help.

Regards,
René

callstack trace number 1:

    Exception         

Exception type AsposeException
Tijd 2021-01-22 05 06 09 88
Version 10 0 14393 0
Source Aspose Email
Target System Object zlheY rs System IAsyncResult)
InnerException
InnerMessage Failure sending mail
StackTrace inner) at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zvQ1hSmY )
at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zjCEeiUo )
at zeb VevKLcqtkXTQZh9MpedEgNslUwI0DLw z1bVEIBzrt9O1 ) end inner)

InnerException InnerMessage Value cannot be null
Parameter name boundary
StackTrace inner) at zhHKJnh54A3KV9 wZLlyL21FGN43n ctor Stream zo3x5g88 String zF7eeRRk String zBKKRSNpDZzEz Int32 zoB6cBsAqHd5U)
at z3uRM6QuBEwCZdlOtjGsMamW24mYJ zM1jby4k zhxREprThJbhOXQsI7smYXwjsLo0v zA15BCz0 Boolean zwfH YPvtt1kI Boolean z3TPvrBBvoVcJ ProgressEventHandlerInfo zHe9bAE4 Action 1 zbNb5aOJx1MnF)
at z3uRM6QuBEwCZdlOtjGsMamW24mYJ zM1jby4k zhxREprThJbhOXQsI7smYXwjsLo0v zA15BCz0 Boolean zwfH YPvtt1kI Boolean z3TPvrBBvoVcJ ProgressEventHandlerInfo zHe9bAE4 Action 1 zbNb5aOJx1MnF)
at zg6m816s2xmfgYrNWzw zM1jby4k zhxREprThJbhOXQsI7smYXwjsLo0v zA15BCz0 ProgressEventHandlerInfo zHe9bAE4 Action 1 zbNb5aOJx1MnF)
at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zvQ1hSmY MailAddress zhMdJRII MailAddressCollection z0mgGVSikniaz7vfa8A MailMessage z1VjSNwc Stream zBeLIKNRww5C8)
at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zvQ1hSmY ) end inner)

Callstack main) at zgU0xQtXyaQt6yfoBz0tX1jykB1kI zlheY rs IAsyncResult zQtjdhyA )
at zgU0xQtXyaQt6yfoBz0tX1jykB1kI zlheY rs )
at Aspose Email Clients Smtp SmtpClient EndSend IAsyncResult asyncResult)
at Aspose Email Clients Smtp SmtpClient Send IConnection connection IEnumerable 1 messages)
at Aspose Email Clients Smtp SmtpClient Send MailMessage message)
at LetterService Mails BasicSendMailOptions CreateAndSendMail ParseTemplateResult result Boolean isExcelFile CredentialsInfo credentials) in D a 56 s LetterService Mails SendMailOptions cs line 368
at LetterService OutputLibraryService ParseWordTemplateForDataSet ParseWordTemplateOptions input CredentialsInfo credentials) in D a 56 s LetterService LetterService asmx cs line 416 end main)

Call stack trace number 2:
Exception
Exception type AsposeException
Tijd 2021-01-22 01 50 35 45
Version 10 0 14393 0
Source Aspose Email
Target System Object zlheY rs System IAsyncResult)
InnerException
InnerMessage Failure sending mail
StackTrace inner) at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zvQ1hSmY )
at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zjCEeiUo )
at zeb VevKLcqtkXTQZh9MpedEgNslUwI0DLw z1bVEIBzrt9O1 ) end inner)

InnerException InnerMessage Stack empty
StackTrace inner) at System ThrowHelper ThrowInvalidOperationException ExceptionResource resource)
at System Collections Generic Stack 1 Pop )
at z3uRM6QuBEwCZdlOtjGsMamW24mYJ z 4pZs6Y4V R Boolean z27drQxTkFV1w)
at z3uRM6QuBEwCZdlOtjGsMamW24mYJ zSq3sE6I Boolean z27drQxTkFV1w)
at z3uRM6QuBEwCZdlOtjGsMamW24mYJ z8w8ulAY zNN0iF7mPLmI3 8pUtB78OULtPEUF g FQ zPv8UOf4 Boolean z27drQxTkFV1w)
at Aspose Email MailMessage zCj3OjDY )
at Aspose Email MailMessage zM1jby4k zhxREprThJbhOXQsI7smYXwjsLo0v zA15BCz0 ProgressEventHandlerInfo zHe9bAE4 )
at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zvQ1hSmY MailAddress zhMdJRII MailAddressCollection z0mgGVSikniaz7vfa8A MailMessage z1VjSNwc Stream zBeLIKNRww5C8)
at znXtyduzAUwXH96GRHNq2YAalqzJIBxz9IQMlBHk zvQ1hSmY ) end inner)

Callstack main) at zgU0xQtXyaQt6yfoBz0tX1jykB1kI zlheY rs IAsyncResult zQtjdhyA )
at zgU0xQtXyaQt6yfoBz0tX1jykB1kI zlheY rs )
at Aspose Email Clients Smtp SmtpClient EndSend IAsyncResult asyncResult)
at Aspose Email Clients Smtp SmtpClient Send IConnection connection IEnumerable 1 messages)
at Aspose Email Clients Smtp SmtpClient Send MailMessage message)
at LetterService Mails BasicSendMailOptions CreateAndSendMail ParseTemplateResult result Boolean isExcelFile CredentialsInfo credentials) in D a 56 s LetterService Mails SendMailOptions cs line 368
at LetterService OutputLibraryService ParseWordTemplateForDataSet ParseWordTemplateOptions input CredentialsInfo credentials) in D a 56 s LetterService LetterService asmx cs line 416 end main)

@info.verne.nu

Thank you for sharing the feedback. I have associated the information in our issue tracking system and we will share the feedback with you as soon as it will be shared. However, as requested earlier, if the problem is not resolved please share the working code that compiles and works.

@info.verne.nu

Can you please share the requested information.