我有一个java Spring网络应用程序,我使用我的Gmail帐户凭据发送电子邮件。一切正常,直到我将我的网站从DigitalOcean迁移到AWS EC2。现在,当我尝试发送电子邮件时,我收到以下错误:
ERROR SendMailServiceImpl:48 - Error sending mail:
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty. Failed messages: javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty; message exceptions (1) are: Failed message 1: javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
这是我的邮件发件人配置:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.gmail.com"/>
<property name="port" value="587"/>
<property name="username" value="myAccount@gmail.com"/>
<property name="password" value="myPassword"/>
<property name="defaultEncoding" value="UTF-8"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
</props>
</property>
</bean>
我的Gmail帐户启用了“允许不受信任的应用程序”。但我一次又一次地得到同样的错误。此外,当我在当地午餐时,一切正常,我没有任何错误
看起来这是远程主机的某种gmail限制
有人知道如何解决这个问题吗?
谢谢