Getting timeout error while sending email through Aspose.Network

We are using SMTPClient class to send emails Synchronously. Sometimes Send() is throwing Operation has timed out exception. Time out seems to happen in 100 seconds.

What can be the reason for this error. Is it timed out due to size of message was larger and send could not complete with in 100 seconds ?

We are not able to identify the reason for this timeout operation. Any help in this regard would help in a big way.

We have 20MB SMTP size and sending 10 to 11 files with the size much less than 10 MB. We also have logic to calculate the header packet and attachment and then prompt the user if it exceeds the SMTP maximum limit. So for sure it is not exceeding SMTP max size.

Note: Aspose.Network.Mail.MailMessage (version 6.3.0.0)

Hi Richa,


Thank you for writing to Aspose support team.

I would like to share that Aspose.Network has been discontinued since long time now and Aspose.Email for .NET has replaced it. Please download the latest version of Aspose.Email for .NET from our product download page and let us know your feedback after testing with this version.

I am using Aspose.Email 5.9.0.0 and have the same behaviour - sometimes Send throws:

  • The operation ‘RCPT’ has timed out. Timeout ‘100000’ has been reached.
  • The operation ‘DATA’ has timed out. Timeout ‘100000’ has been reached.

I am sure this is not caused by size limitation, because such exceptions also occur on plain messages without attachments. We send messages to Exchange Online, but not sure such behavior is impact of Exchange Online. This is very rare error - only 4 emails from 700 has thrown timeout exception.

Many thanks,
Alex Shloma

Hi Alex,

We are unable to reproduce this issue at our end as all the emails sent to Office 365 Exchange account are delivered without any issue. Can you please try the same application on another pc or another internet connection and share your feedback with us? The Smtp Activity Logging may be of help in this regard.

Hi Kashif,


Is there a way to enable logging from code and specify location? Because enabling via config file works for my test application (desktop), but does not work for windows service.

Thanks,
Alex

Accordingly to this post SmtpClient network activity log log file was found in SysWOW64. Tried to change location, but it still changes only file name. Do you have ability to specify log location?


Thanks,
Alex

Hi Alex,

I have tested the logging feature and set the path for log file. It is observed that log file is created successfully at the specified location and no issue is observed. Following is the App.config contents for your reference. Please give it a try and share the feedback.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="Aspose.Email.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <applicationSettings>
        <Aspose.Email.Properties.Settings>
            <setting name="SmtpDiagnosticLog" serializeAs="String">
                <value>d:\\Aspose.Email.SMTP.log</value>
            </setting>
        </Aspose.Email.Properties.Settings>
    </applicationSettings>
</configuration>

Hi Kashif,


I’ve tried such approach yesterday - it only changes the name of log file, but anyway places it in the same folder where exe file (for desktop application)

Thanks,
Alex

Hi Alex,


Thank you for writing to us again. Here a complete project is attached which contains a test account credentials as well. You just use your license and run the application. It is creating log file in D directory as mentioned in the configuration file. Please give it a try and share the feedback. Please try it on more than one system and make sure that writing permission is available to the disc where log file is to be written.

Thanks for test project,

Now I’ve noticed in my test application I’ve used old Email.dll. Thanks for support - now log file created in the specified destination. Will enable logging in my production version and hope it will bring some clarity to this issue.


Many thanks,
Alex

Hi Alex,


Thank you for the feedback. Please feel free to write us back if you have any other query related to Aspose.Email.

Sure

Now I’m trying to catch exception and find any useful information in the enabled log.


Many thanks,
Alex

You are welcome.