从Localhost到Postfix的Ruby Mail Gem中继访问

时间:2019-03-25 13:39:43

标签: ruby email mail-gem

我在没有FQDN的工作站上。我正在Ruby中开发并使用mail gem。我在局域网上托管自己的邮件服务器。我想将传出的电子邮件转发到该服务器,而不是gmail收件人(例如)。

由于我在工作站(localhost)上,因此它未被识别为我的一个LAN域(我有一个static IP)的一部分,因此未被识别通过Postfix(来自我的邮件服务器日志):

Mar 25 08:44:30 machine.mydomain1.com postfix/smtpd[9653]: sacl_check: mbr_user_name_to_uuid(mygmail@gmail.com) failed: No such file or directory
Mar 25 08:44:30 machine.mydomain1.com postfix/cleanup[9657]: sacl_check: mbr_user_name_to_uuid(mygmail@gmail.com) failed: No such file or directory
Mar 25 08:44:30 machine.mydomain1.com postfix/smtp[9658]: 92946D63CD4: to=<mygmail@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.14, delays=0.01/0.01/0/0.11, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as AE8ECD63CDA)
Mar 25 08:44:31 machine.mydomain1.com postfix/smtp[9661]: AE8ECD63CDA: to=<mygmail@gmail.com>, relay=gmail-smtp-in.l.google.com[173.194.195.26]:25, delay=0.52, delays=0/0.01/0.34/0.16, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[173.194.195.26] said: 550-5.7.1 [206.248.184.17      11] Our system has detected that this message is 550-5.7.1 not RFC 5322 compliant: 550-5.7.1 'From' header is missing. 550-5.7.1 To reduce the amount of spam sent to Gmail, this message has been 550-5.7.1 blocked. Please visit 550-5.7.1  https://support.google.com/mail/?p=RfcMessageNonCompliant 550 5.7.1 and review RFC 5322 specifications for more information. a2si7453997iog.10 - gsmtp (in reply to end of DATA command))
Mar 25 08:56:42 machine.mydomain1.com postfix/smtpd[9764]: NOQUEUE: reject: RCPT from unknown[192.168.1.4]: 554 5.7.1 <mygmail@gmail.com>: Relay access denied; from=<alpha@mydomain3.ca> to=<mygmail@gmail.com> proto=ESMTP helo=<mydomain3.ca>

我可以在另一个mail很好的盒子上正确使用FQDN宝石。我似乎无法在工作站上正常工作。如邮件服务器日志中所述:

'From' header is missing. 550-5.7.1 To reduce the amount of spam sent to Gmail, this message has been 550-5.7.1 blocked.

我假设这是计算机的名称,来自,而不是电子邮件发件人,来自。如何告诉邮件服务器我不是localhost?我搞砸了relay中的directives和其他postfix,但无济于事。因此,我正在尝试修改Ruby语法以使服务器识别出我。

任何有识之士都对我如何使它发挥作用表示赞赏。这是我的开发箱,可以在我的生产服务器上使用,但是我想在我的开发箱上使用它。

1 个答案:

答案 0 :(得分:0)

添加以下内容进行修复,这是assert的宝石:

Authorization

还要确保正确设置Authorization中的import requests link = "https://findadentist.ada.org/api/Dentists?Address=usa&Specialty=1&Distance=100" headers={ 'Authorization': 'Basic <REDACTED>', 'Referer': 'https://findadentist.ada.org/search-results?specialty=1&address=usa&distance=100', } response = requests.get(link,headers=headers).json() print(response) 信息。