I set the Timeout of SMTPClient to 30000 milliseconds and expect the send to timeout at the specified milliseconds when there is an issue, however when the Port Number is incorrect (Tried 584 instead of 587 on smtp.office365.com), I see the send waits for nearly 8 minutes to timeout. Please advise.
Hi Sathyapriya,
Thank you Kashif. Please could you give me a timeframe for this fix to be ready?
Hi Sathyapriya,
Hi, I am also having the same issue and would like some clarrification…
Further to my last post, I did some more testing to different servers with the same timeout property settings (ConnectionTimeout=15000 and Timeout=10000), and each one times out at a different interval.
Here are the results. All 3 servers are invalid as that’s what I’m testing for so they should produce no response to the send request.
smtp.gmail.com (port 222) - timeout after 207 seconds
invalid IP address on local subnet - timeout after 42 seconds
localhost (port 25) - timeout after 104 seconds
Each test was repeated 3 times giving exactly the same result, so it’s consistent per server, but it should be the same regardless of the server.
This makes it impossible for our software to behave in a predictable manor. We need a way to specify a timeout and have it actually throw the timeout exception after that exact amount of time.
Hi David,
The issues you have found earlier (filed as EMAILNET-34855) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
I see that this issue is not resolved yet. (Version 5.6.0)
Hi Sathyapriya,
We have tested this issue with the latest version of Aspose.Email for .NET 5.6.0 and the following code sample. The API is respecting the behavior set in ConnectionTimeOut property of the SmtpClient class. Please check the following sample code at your end that has a test account credentials of an Office 365 account. It is behaving as expected. Please let us know your feedback.
Sample Code:
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–>
MailMessage msg = new MailMessage("UserOne@Ase1984.onmicrosoft.com", "recipient@gmail.com", "test", "Body");
SmtpClient client = new SmtpClient("smtp.office365.com", 584, "UserOne@Ase1984.onmicrosoft.com", "Aspose1234");
client.SecurityOptions = SecurityOptions.Auto;
client.ConnectionTimeout = 40*1000;
Console.WriteLine(DateTime.Now);
try
{
client.Send(msg);
}
catch (Exception ex)
{
Console.WriteLine(DateTime.Now);
}