AWS SES邮件服务问题:端口?超时? STARTTLS?

时间:2017-09-29 21:23:11

标签: c# .net asp.net-mvc amazon-web-services smtp

我正在尝试使用亚马逊的服务发送电子邮件:

 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();
        }
    }

为什么我的请求超时?我试过搜索互联网,但除了要求我启用TLS之外,aws没有明确的解决方案。我相信client.enablessl可以做到这一点。我是否也需要处理我的客户?即client.dispose();

1 个答案:

答案 0 :(得分:2)

official documentation判断,您应该连接到端口587