我正在尝试使用 smtp 从 Rails 应用程序发送电子邮件。发送电子邮件不会导致问题,但某些收件人不会收到电子邮件。相反,送达通知(“退回给发件人的未送达邮件”)与以下内容一起返回:
Diagnostic-Code: smtp; 554 5.7.0 Reject, id=04635-09 - spam: This message was
blocked for security reasons
现在奇怪的部分:
- 通过邮件客户端通过 smtp(TLS/SSL true,端口 465,auth:密码)发送测试邮件有效。收件人收到没有错误的电子邮件。
sendemail -o tls=yes -f foo@fiedlschuster.de -t bar@example.com -s 212-227-10-158.benjaminkant.de -xu foo@fiedlschuster.de -xp password -u "Hello from sendemail" -m "This is a test." -vvvv
通过作品发送电子邮件。收件人收到没有错误的电子邮件。使用相同的 smtp 帐户通过邮件 gem发送电子邮件(这是我想要实现的)有效,但收件人没有收到电子邮件。而是将“未投递的邮件退回给发件人”发送到发件人地址。
require 'mail' options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo@fiedlschuster.de", password: "...", authentication: "login"} Mail.defaults { delivery_method :smtp, options } message = Mail.new(to: "bar@example.com", from: "foo@fiedlschuster.de", subject: "Test", body: "This is a test.") message.deliver
另外,我尝试了这些选项,导致同样的问题:
options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo@fiedlschuster.de", password: "...", authentication: "login"} options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo@fiedlschuster.de", password: "...", authentication: "login", enable_starttls_auto: true} options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo@fiedlschuster.de", password: "...", authentication: "login", port: 465, enable_starttls_auto: false, ssl: true} options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo@fiedlschuster.de", password: "..."}
这对任何人都有意义吗?
附加信息
MX 记录
▶ host -t MX fiedlschuster.de
fiedlschuster.de mail is handled by 10 mail.fiedlschuster.de.
▶ host -t MX 212-227-10-158.benjaminkant.de
212-227-10-158.benjaminkant.de has no MX record