0

リモートメールサーバーを使用して VPS Windows 2012 & IIS 8 サーバーからメールを送信しようとしましたが、メールを送信できず、エラーが発生しました

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( _"emails@domain.org", "email@domain.org")
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 からは smtp サーバーに telnet できませんが、ローカル システムからは可能です。

4

1 に答える 1

2
  • IIS サーバーの発信 IP アドレスをファイアウォールに追加する必要がある場合があります。可能な場合はhttp://whatismyipaddress.com/にアクセスすると、送信アドレスがわかります。
  • ウイルス対策の構成を確認する必要がある場合があります。McAffee を使用している場合は、http://digital.ni.com/public.nsf/allkb/76D1CFA7F3C047D08625719B006861B5 が役立ちます
  • コードで SMTP サーバーのホスト名として「ホスト」を指定する代わりに、SMTP サーバーの IP アドレスを指定してみてください。
  • また、SMTP サーバーに telnet で接続できるようになったら、アプリケーションが最終的に実際の SMTP サーバーに接続するのを妨げているアンチスパムがないことを確認してください。
于 2014-04-28T06:53:41.480 に答える