我试图使用亚马逊的服务SES发送电子邮件:AWS SES邮件服务问题:端口?超时? STARTTLS?
String username = "&&&&&&"; // Replace with your SMTP username.
String password = "&&&&&&&"; // Replace with your SMTP password.
String host = "email-smtp.us-west-2.amazonaws.com";
int port = 25;
String senderAddress = "[email protected]";
String receiverAddress = inputEmail;
using (var client = new System.Net.Mail.SmtpClient(host, port))
{
client.Credentials = new System.Net.NetworkCredential(username, password);
client.EnableSsl = true;
String message = "Trucking On Demand received a request to reset the password for your account " + inputEmail + ".Your new password is: " + tempPassword;
client.Send
(
senderAddress, // Replace with the sender address.
inputEmail, // Replace with the recipient address.
message,
"This email was delivered through ****."
);
return Ok();
}
}
为什么我的请求超时?我试图搜索互联网,但除了要求我启用TLS之外,aws并没有明确的解决此问题的答案。我相信client.enablessl可以完成这项工作。我是否也需要处置我的客户?即client.dispose();
你真的只是超时,或者你得到一个真正的错误?您在哪个地区配置了SES账户? orhtej2提供的链接就是一个很好的例子。我会从那开始,然后向后工作到您的代码。注意:您必须使用端口587.端口25不受支持。 –