本文介绍了“System.Net.Mail.SmtpException:从远程邮件服务器发送邮件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从窗户VPS 2012&放发送邮件;使用远程邮件服务器IIS 8服务器,我无法发送的邮件,并得到了错误
i tried to send mail from a VPS windows 2012 & IIS 8 server using a remote mail server , i couldn't sent mails,and got the error
send Faild - System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 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 <Ip Address> at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at WebApplication1.Default.Page_Load(Object sender, EventArgs e)使用code
<% Dim Email As New System.Net.Mail.MailMessage( _"emails@domain", "email@domain") Email.Subject = "test subject" Email.Body = "this is a test" Dim mailClient As New System.Net.Mail.SmtpClient() 'This object stores the authentication values Dim basicAuthenticationInfo As _ New System.Net.NetworkCredential("username", "password") mailClient.Host = "host" mailClient.UseDefaultCredentials = False mailClient.Credentials = basicAuthenticationInfo mailClient.Send(Email) %>更新
无法从VPS的telnet SMTP服务器,而是从本地系统的可能。
not able to telnet smtp server from the vps, but from local systems its possible.
推荐答案- 您可能需要您的IIS服务器的添加您的发送IP地址,你的防火墙。转到 whatismyipaddress/ 的,如果你能,这将告诉你,你出站的地址。
- 您可能需要看看你的防病毒配置 - 如果你使用MCAFFEE这可能会帮助:的 digital.ni/public.nsf/allkb/76D1CFA7F3C047D08625719B006861B5
- 而不是在code作为SMTP服务器主机名指定的主机,你可以尝试指定您的SMTP服务器的IP地址
- 也一度可以telnet到SMTP服务器,请确保没有防垃圾邮件越来越在从最终连接到实际的SMTP服务器 停止您的应用程序的方式
- You may need to add your outgoing IP address of your IIS server to your firewall. Go to whatismyipaddress/ if you're able to, this will tell you your outbound address.
- You may need to look at your antivirus configuration - if you're using McAffee this may help: digital.ni/public.nsf/allkb/76D1CFA7F3C047D08625719B006861B5
- instead of specifying "host" in your code as the SMTP server hostname, you could try specifying the IP address of your SMTP server
- also once you can telnet to the SMTP server, make sure there's no anti-spam getting in the way that is stopping your application from finally connecting to the actual SMTP server
更多推荐
“System.Net.Mail.SmtpException:从远程邮件服务器发送邮件失败
发布评论