通过somain registrar 1and1 smtp使用Spring邮件发送邮件时遇到麻烦 [英] trouble with sending mail with Spring mail through somain registrar 1and1 smtp
问题描述
我正在尝试从Spring Boot应用程序发送带有Spring Mail(1.5.8.RELEASE)JavaMailSender的电子邮件
I'm trying to send an email from a spring boot application with spring mail (1.5.8.RELEASE) JavaMailSender
很好.但是无法通过我的域名注册商的amtp(注册商名称为1and1,如果有人已经解决了此问题)发送电子邮件.
sending through gmail SMTP is fine. however sending email through my domain registrar's amtp (registrar name- 1and1, in case someone already worked this out) is not working.
我收到此错误,该错误是imo-比有用的更通用: com.sun.mail.smtp.SMTPSenderFailedException:550请求的操作未执行:邮箱不可用 550个无效的DNS MX或A/AAAA资源记录
I'm getting this error, which imo - is more generic than useful: com.sun.mail.smtp.SMTPSenderFailedException: 550-Requested action not taken: mailbox unavailable 550 invalid DNS MX or A/AAAA resource record
域是bank.org,并且具有以下DNS设置:
domain I'm sending through is bank.org, and has this DNS settings:
bank.org. 3600 IN A 178.79.161.205
bank.org. 3600 IN MX 11 mx01.1and1.com.
bank.org. 3600 IN MX 10 mx00.1and1.com.
问题是,我可以使用本指南中指定的设置向gmail发送电子邮件: http://www.baeldung.com/spring-email
the issue is, I'm able to send emails to gmail with the settings specified in this guide: http://www.baeldung.com/spring-email
这些是通过gmail发送的设置:
these are settings to send with gmail:
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=<login user to smtp server>
spring.mail.password=<login password to smtp server>
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
但是,当我尝试通过注册商发送邮件时,这些设置不成功:
However when i try to send messages via my registrar these settings are not successful:
spring.mail.host=smtp.1and1.com
spring.mail.port=587
spring.mail.username=username
spring.mail.password=password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
问题是-我能够使用雷鸟电子邮件客户端连接到1and1 SMTP.所以我知道凭据在起作用.
thew issue is - I am able to connect to the 1and1 SMTP using thunderbird email client. so I know the credentials are working.
我想我需要找到一种检测正确设置的方法,因为支持团队无法解决与从Spring Mail以编程方式发送电子邮件有关的问题
I guess what I need is to find out a way to detect the correct settings because the support team can't assist with issues related to sending email programmatically from spring mail
推荐答案
问题的原因是-我没有以编程方式在我的待发邮件中设置发件人字段(发件人"字段)
一旦我设置了 发件人 字段,问题就解决了.
Once i set the From field the issue was resolved.
不幸的是,来自1and1的SMTP的响应是不相关的("550个无效的DNS MX或A/AAAA资源记录")
unfortunately the response from 1and1's SMTP was irrelevant ("550 invalid DNS MX or A/AAAA resource record")
希望这对任何人都有帮助
Hope this helps anyone
这篇关于通过somain registrar 1and1 smtp使用Spring邮件发送邮件时遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!