0
我試圖從VPS窗口發送郵件2012 &使用遠程郵件服務器的IIS 8服務器,我無法發送郵件,並且出現錯誤'System.Net.Mail.SmtpException:從遠程郵件服務器發送郵件失敗
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)
代碼中使用
<%
Dim Email As New System.Net.Mail.MailMessage(_"[email protected]", "[email protected]")
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)
%>
更新
無法遠程登錄SMTP服務器從VPS,但是從本地系統的可能。
可能有許多原因這個。你是否在可能阻止SMTP請求的防火牆之後?你的地址是否正確? –
我認爲它無法連接到您的SMTP服務器。可能是防火牆或防病毒軟件。您需要允許來自防火牆和防病毒軟件。 –
即使防火牆關閉,它不工作,它從本地服務器正常工作 – sarath009