Could not connect to SMTP host: email-smtp.us-east-1.amazonaws.com, port: 465, response: -1

前端 未结 7 1328
予麋鹿
予麋鹿 2020-12-14 10:36

I am trying to send email with Amazon\'s SES/SMTP and I am getting the following error:

javax.mail.MessagingException: Could not connect to SMTP host: em

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 11:24

    These settings worked for me:

    mail.transport.protocol=smtp
    mail.smtp.port=25
    mail.smtp.auth=true
    mail.smtp.starttls.enable=true
    mail.smtp.starttls.required=true
    mail.smtp.host=email-smtp.us-east-1.amazonaws.com
    mail.smtp.user=[SMTP username]
    mail.smtp.password=[SMTP user password]
    

    If you try to connect to connect using SSL connection, it rejected the connection. So you need to do STARTTLS after connection.

    You can add mail.debug=true to see where it failed.

    The sender email address must be a verified email address otherwise SES refuses to forward the email.

提交回复
热议问题