我试图通过亚马逊AWS发送电子邮件
我已经确认我可以通过邮件发送电子邮件,如下所示:
postie.exe -host:email-smtp.eu-west-1.amazonaws.com -port:587 -ssl -tls -esmtp -to:barn.fleischer@gmail.com -from:barn.fleischer@gmail.com - s:“testmail”-msg:“这是一个测试”-user:XXXX -pass:YYYY
但是当我尝试通过System.Net.Mail发送时
<mailSettings>
<smtp from="barn.fleischer@gmail.com">
<network host="email-smtp.eu-west-1.amazonaws.com"
port="587"
userName="XXXX"
password="YYYY"
enableSsl="true"/>
</smtp>
</mailSettings>
Unhandled Exception: System.Net.Mail.SmtpException: Failure sending mail.
---> System.Net.WebException: Unable to connect to the remote server
---> System.Net.Sockets.SocketException:
No connection could be made because the target machine actively refused it
有什么建议?
埃里克
1 回答
您是否检查过该服务器上的传出Windows防火墙设置?确保您已打开所有标准端口,例如25 465 587等 .