We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cannot send an email : The operation has timed out

Dear Aspose Support Team

We has developed EDI tool to generate EDI file and attached on email.
The problem is that the email cannot be sent due to this error message.

Aspose.Email.Mail.SmtpException: The operation has timed out.
at Aspose.Email.Mail.SmtpClient.BulkSend(IEnumerator messages)
at MOLEDI.WinSendMail.Sending_EDI_MOL(Int32 iAgentID, String sIn_Out)


So. could you please help us to investigate this problem ?
We are looking forward to receive your advice in advance.

Thanks & Best regards

Jakkapong Singhakul
INFONET INTERNATIONAL CO.,LTD.
http://www.infonet.co.th
"A Partner of Success"
Tel : (662) 308-0090-2
Fax : (662) 308-0093

Hi Jakkapong,

Thank you for writing to Aspose support team.

Could you please share with us which email server you are using with our SmtpClient? I have tested this scenario with Gmail and no exception is raised. Please share the details with us for our investigation. Also, you may try increasing the SmtpClient.Timeout property to check if it makes any difference. If this still doesn’t help, you may get the activity log of the smtp client and share with us so that we can investigate it further.

Dear Aspose Support Team

Thanks a lot for your kind support.
We have a few more questions to ask you.

- What is a unit of SmtpClient.Timeout property ? such as second, millisecond or something ?
- Is there the maximum value of
SmtpClient.Timeout property which can be set ?
or we can set this parameter without a limitation ?

Thanks for your answers in advance.

Thanks & Best regards

Jakkapong Singhakul
INFONET INTERNATIONAL CO.,LTD.
http://www.infonet.co.th
"A Partner of Success"
Tel : (662) 308-0090-2
Fax : (662) 308-0093

Hi Jakkapong,


  • The unit of Timeout property is Milliseconds where 1000 ms= 1 second
  • There is as such no maximum value of Timeout property and you can try with various values.
Please let us know if we can be of any additional help to you in this regard.

Dear Aspose Support Team

Thanks a lot for your quick response.

Now, we’ve increased the timeout property as 3,000 ms.
Once we got the testing result, we will let you know.


Thanks & Best regards

Jakkapong Singhakul
INFONET INTERNATIONAL CO.,LTD.
http://www.infonet.co.th
"A Partner of Success"
Tel : (662) 308-0090-2
Fax : (662) 308-0093

Hi Jakkapong,

Please feel free to contact us in case you still face the issue. If the issue still persists, I would request you to provide us a test account credentials so that we can use it for investigating this issue at our end and assisting you further.

Dear Aspose Support Team

Good afternoon.
We found an another error message while the email cannot be sent due to this error message.
<!–[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>TH</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:ApplyBreakingRules/>
<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]–>

Aspose.Email.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: NameResolutionFailure at .‡.Initialize(String , Int32 ) at .šŸ.ƒ() at œ.ƒ.‚‡() at Aspose.Email.Mail.SmtpClient..™?™.››(Object ) --- End of inner exception stack trace --- at Aspose.Email.Mail.SmtpClient.BulkSend(IEnumerator messages) at MOLEDI.WinSendMail.Sending_EDI_MOL(Int32 iAgentID, String sIn_Out)

So. could you please help us to investigate this problem ?
We are looking forward to receive your advice in advance.

Thanks & Best regards

Jakkapong Singhakul
INFONET INTERNATIONAL CO.,LTD.
http://www.infonet.co.th
"A Partner of Success"
Tel : (662) 308-0090-2
Fax : (662) 308-0093

Hi Jakkapong,

I have tested it again using following sample code but am afraid that could not observe any issue. It seems some specific issue with the server or credentials and needs further investigation. Could you please provide us some test account credentials which can be used here for testing? It will help us to analyze the problem and provide assistance as soon as possible.

static SmtpClient GetSmtpClient()
{
SmtpClient client = new SmtpClient();
client.Host = “smtp.gmail.com 2”;

//Specify your mail user name
client.Username = “user2”;

//Specify your mail password
client.Password = “password;

//Specify your Port #
client.Port = 587;
client.SecurityOptions = SecurityOptions.SSLExplicit;
return client;
}

static void EMAIL_450651()
{
SmtpClientBulkSendAgent agent = new SmtpClientBulkSendAgent(GetSmtpClient2());
String From = "fromuser@gmail.com”;
String To = "touser@gmail.com";
MailMessage msg1 = new MailMessage(From, To, “Subject1”, “message1, how are you?”);
MailMessage msg2 = new MailMessage(From, To, “Subject2”, “message2, how are you?”);
MailMessage msg3 = new MailMessage(From, To, “Subject3”, “message3, how are you?”);
MailMessage msg4 = new MailMessage(From, To, “Subject4”, “message4, how are you?”);
MailMessage msg5 = new MailMessage(From, To, “Subject5”, “message5, how are you?”);
MailMessage msg6 = new MailMessage(From, To, “Subject6”, “message6, how are you?”);
MailMessage msg7 = new MailMessage(From, To, “Subject7”, “message7, how are you?”);
MailMessage msg8 = new MailMessage(From, To, “Subject8”, “message8, how are you?”);
MailMessage msg9 = new MailMessage(From, To, “Subject9”, “message9, how are you?”);
MailMessage msg10 = new MailMessage(From, To, “Subject10”, “message10, how are you?”);

//you can create as many instances of MailMessage class as you like.
//Create an instance of MailMessageCollection class

MailMessageCollection manyMsg = new MailMessageCollection();
manyMsg.Add(msg1);
manyMsg.Add(msg2);
manyMsg.Add(msg3);
manyMsg.Add(msg4);
manyMsg.Add(msg5);
manyMsg.Add(msg6);
manyMsg.Add(msg7);
manyMsg.Add(msg8);
manyMsg.Add(msg9);
manyMsg.Add(msg10);
agent.AddMessages(manyMsg);
agent.MessageSent += new EventHandler(bulkAgent_MessageSent);
agent.MessageSending += new EventHandler(bulkAgent_MessageSending);
agent.Start();
Console.WriteLine(“ActiveThreads=” + agent.ActiveThreads);
}

static void bulkAgent_MessageSent(object sender, EventArgs e)
{
SmtpClientBulkSendEventArgs ev = (SmtpClientBulkSendEventArgs)e;
Console.WriteLine(ev.Message.To.ToString() + “. Message Sent.”);
}

static void bulkAgent_MessageSending(object sender, EventArgs e)
{
SmtpClientBulkSendEventArgs ev = (SmtpClientBulkSendEventArgs)e;
Console.WriteLine(ev.Message.To.ToString() + “. Sending message.”);
}