I am trying to send an email using amazon's ses service:
String username = "&&&&&&"; // Replace with your SMTP username.
String password = "&&&&&&&"; // Replace with your SMTP password.
String host = "xxxxxxxx";
int port = 25;
String senderAddress = "xxxxxx";
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();
}
}
Why is my request timing out? I have tried searching internet but aws does not have a clear cut answer for this problem except asking me to enable TLS. I believe client.enablessl does that job. Do I need to dispose my client too? ie client.dispose();
从官方文档来看,您应该连接到端口587
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.