try
{
MailMessage mail = new MailMessage();
mail.To.Add(txtemailid.Text);
mail.From = new MailAddress("info@abc.org");
mail.Subject = "Mail From Admin...";
Literal ltrlBody = new Literal();
ltrlBody.Text = "<font color=red>*** This is an auto generated mail. Please do not reply ***</font>";
mail.Body = ltrlBody.Text;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High;
Member
6 Points
17 Posts
The operation timed out
Jun 28, 2017 09:41 AM|mamidi234|LINK
I am sending mail using godaddy mails in my project its continuously loading after some time it shows one message The operation timed out.
this my web.config code
<mailSettings>
<smtp deliveryMethod="Network" from="info@abc.org">
<network host="smtpout.secureserver.net" port="25" userName="info@abc.org" password="1a1212"/>
</smtp>
</mailSettings>
this is my .cs code
try
{
MailMessage mail = new MailMessage();
mail.To.Add(txtemailid.Text);
mail.From = new MailAddress("info@abc.org");
mail.Subject = "Mail From Admin...";
Literal ltrlBody = new Literal();
ltrlBody.Text = "<font color=red>*** This is an auto generated mail. Please do not reply ***</font>";
mail.Body = ltrlBody.Text;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High;
SmtpClient smtp = new SmtpClient();
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.EnableSsl = true;
smtp.Host = "smtpout.secureserver.net";
smtp.Port =25;
smtp.UseDefaultCredentials = false;
NetworkCredential credentials = new NetworkCredential("info@abc.org", "1a1212");
smtp.Credentials = credentials;
smtp.Send(mail);
}
catch (Exception ex)
{
lblerr.Text = ex.Message;
ScriptManager.RegisterStartupScript(this, this.GetType(), "err_msg", "alert('message'+ ex.Message);", true);
return;
}
If any reason or solution are have please tell me asap.
Thanks in advance.
All-Star
43240 Points
14967 Posts
Re: The operation timed out
Jun 28, 2017 11:53 AM|PatriceSc|LINK
Hi,
The server name is correct? Seems other posts are using relay-hosting.secureserver.net instead ? BTW it happens when running on GoDaddy ?
You could store setttings in web.config using https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/network/smtp-element-network-settings so that you can change them on the fly depending on your deployment and have something that works both locally for example with Outlook or Gmail and when hosted on GoDaddy with their own SMTP server.
All-Star
26021 Points
5875 Posts
Re: The operation timed out
Jul 02, 2017 10:30 PM|markfitzme|LINK
Also check the port. I can't remember but I always thought GoDaddy used alternate ports.