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: email-smtp.us-east-1.amazonaws.com, port: 465, response: -1
Here is how I am trying to send the mail:
Spring mail sender config:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.server}"/>
<property name="port" value="${mail.port}"/>
<property name="username" value="${aws.mail.smtp.user}"/>
<property name="password" value="${aws.mail.smtp.password}"/>
<property name="javaMailProperties">
<props>
<!-- Use SMTP-AUTH to authenticate to SMTP server -->
<prop key="mail.smtp.auth">true</prop>
<!-- Use TLS to encrypt communication with SMTP server -->
<prop key="mail.smtp.starttls.enable">true</prop>
</props>
</property>
</bean>
with:
mail.server =email-smtp.us-east-1.amazonaws.com
mail.port = 465
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…