我希望能够在我的应用程序中在我自己的域中使用我自己的电子邮件地址。
我定义了以下内容:
spring.mail.host=smtp.gmail.com
spring.mail.username=example
spring.mail.password=*****
spring.mail.protocol=smtp
spring.mail.port=587
效果很好。但是,当我切换到自己的域并设置信息时:
spring.mail.host=da16.domeny.com
spring.mail.username=contact@mydomain.com
spring.mail.password=*****
spring.mail.protocol=smtp
spring.mail.port=587
控制台读取:
2016-09-01 15:16:37,475 错误 o.a.c.c.C.[.[.[.[dispatcherServlet]:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.mail.MailSendException: Failed messages: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 Nieprawidlowy adres nadawcy / incorrect envelope address ; message exceptions (1) are: Failed message 1: javax.mail.SendFailedException: Invalid Addresses;
当我尝试发送电子邮件时。我的域名提供商要求我在尝试使用 smtp 连接时在用户名中指定我的完整电子邮件地址。任何想法为什么它可能不起作用?
最佳答案
实际上,域名提供商无法发送我的电子邮件,因为我没有在 MimeMessageHelper
中设置“from
”字段。我很惊讶,因为 GMail 帐户不需要这样做。
关于java - Spring mail - 电子邮件形式的用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39272577/