从错误发送Asp.Net/C#邮件 [英] Error sending mail from Asp.Net/C#

查看:204
本文介绍了从错误发送Asp.Net/C#邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个反馈page.I我试图从PAGE电泳客户端发送邮件与 SMTP服务器名字,电子邮件给我提供ID 密码。但是,当我试图从我收到以下错误页面发送邮件。

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.

一个连接尝试失败,因为连接的方没有正确一段时间后响应或已建立的连接
  失败,因为连接主机未能响应64.37.118.141:25

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

下面是我的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 + "<br/><br/>Sender Last Name:"+LastName.Text+"<br/><br/>Sender Company:"+Company.Text+"<br/><br/>Sender Designation"+Designation.Text+"<br/><br/>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);

谁能帮我这个?

任何建议都欢迎。

推荐答案

这很可能表明你没有任何正确的主机名,或正确的端口。

This most likely indicates you don't have either the correct host name, or the correct port.

如果您使用的是SSL,则默认SMTP端口是25将无法正常工作。我注意到,你也有一个线路设置什么注释掉的端口。

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.

尝试设置端口为587,如果还是不行,请尝试端口465是有时用于安全SMTP。

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 either confirm with your client the correct port and host name..

和你可能想仔细检查另一件事是您正在使用的SMTP服务器是否确实如此支持/要求SSL。如果它不支持SSL,你将需要设置 EnableSSL 选项设置为false,并尝试连接的25(或任何端口他们使用)的默认端口。

And another thing you may want to double check is whether the SMTP server you are using does indeed support/require SSL. If it does not support SSL that you will need to set the EnableSSL option to false and try connecting on the default port of 25 (or whatever port they are using).

这篇关于从错误发送Asp.Net/C#邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆