简体   繁体   English

无法从AWS发送电子邮件

[英]Can't send email from AWS

my application is on aws EC2 it was sending email very well suddenly it started throwing exception 我的应用程序在aws EC2上,发送电子邮件非常好,突然开始抛出异常

javax.mail.MessagingException'.
javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: authentication failure

    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:826)
    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:761)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:685)
    at javax.mail.Service.connect(Service.java:317)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:194)
    at javax.mail.Transport.send(Transport.java:124)
    at com.server.utils.EmailServicesImpl.sendMail(EmailServicesImpl.java:56)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:110)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.lang.Thread.run(Thread.java:745)

Here is my email settings 这是我的电子邮件设置

mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.mydomain.in
mail.smtp.port = 587

i tried with port 25 also but the problem is still same. 我也尝试使用port 25但问题仍然相同。

According to your setting, you require StartTLS. 根据您的设置,您需要StartTLS。 The default port for that is 587 which is fine; 默认端口是587,可以。 changing it to 25 will most definitely break it. 将其更改为25绝对会破坏它。

And your error message states authentication failed , so I'd suspect that you are either not providing credentials or the wrong ones. 并且您的错误消息指出authentication failed ,因此我怀疑您未提供凭据或凭据错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM