Error In Sending Email Asp.net
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error sending mail from Asp.Net/C# up vote 1 down vote favorite I have built a feedback page.I am trying to send mail from the page.The client provided me with the SMTP Server name , Email ID and Password.But when I try to send mail from the page I am getting following error. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 64.37.118.141:25 Here is my code MailMessage feedBack = new MailMessage(); //feedBack.To.Add("master@myclient.com"); feedBack.From = new MailAddress("master@myclient.com"); feedBack.Subject = "Mail from Explor Corporate Website."; feedBack.Body = "Sender Name: " + Name.Text + "
Sender Last Name:"+LastName.Text+"
Sender Company:"+Company.Text+"
Sender Designation"+Designation.Text+"
Sender Email:"+Email.Text+"Sender Phone No:"+ PhoneNo.Text+"Sender Enquiry:"+Enquiry.Text; feedBack.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.myclient.com"; //Or Your SMTP Server Address //smtp.Port = 587; smtp.EnableSsl = true; smtp.Credentials = new System.Net.NetworkCredential("master@myclient.com", "*****"); //Or your Smtp Email ID and Password smtp.Send(feedBack); Can anyone help me out with this? Any suggestions are welcome. c# asp.net email share|improve this question edited Jun 29 '12 at 16:51 marc_s 452k938641030 asked Jun 29 '12 at 16:15 freebird 4,45773568 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote accepted This most likely indicates you don't have either the correct host name, or the correct port. If you are using SSL then the default SMTP port which is 25 will not work. I noticed that you did have a line setting the port what was commented out. Try setting the port to 587 and if that doesn't work, try port 465 which is sometimes used for secure SMTP. If that doesn't work
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up http://stackoverflow.com/questions/11265376/error-sending-mail-from-asp-net-c How to send error info mail, if any error occurred in web application up vote 1 down vote favorite Here the scenario is I have many .aspx pages if any page gives error, it will redirect to an error page Web.config:
from taking advantage http://www.smarterasp.net/support/kb/a179/how-to-send-email-in-asp_net.aspx of our Free Trial Service. You should use the smtp server assigned to your account "mail.yourdomain.com" as the SMTP outgoing server for your web applications(Replace yourdomain.com to your own domain name). To get your SMTP server setup, please follow the below: 1) Login to error in your control panel 2) Make sure a domain name is added to your account by going to Hosting Control Panel -> Website Domain Manager 3) Once the domain name is added to your account, go to Hosting Control Panel -> Email Manager and error in sending activate your email service for your domain name. 4) Create the necessary email account that you need. Your script MUST send from an valid Email account. So create the ones you need. 5) Done! Please follow below's code sample to send emails. YOU MUST USE SMTP AUTHENTICATION ASP.NET 2.0 (and later) has a built in class, System.Net.Mail, to send email. VB.NET Code Sample <%@PageLanguage="VB"%> <%@ImportNamespace="System.Net.Mail"%>