我的虚拟机上安装了Linux Ubuntu 14.04。 最近我已经使用GitLab 网站上的说明安装了GitLab 7.8.2,并且遇到了使Gitlab发送邮件的问题。
例如,当我尝试使用Web界面创build新用户时,我没有从服务器获取任何确认邮件。
我将这行添加到文件/opt/gitlab/embedded/service/gitlab-ci/config/environments/production.rb :
config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: "127.0.0.1", port: 25, enable_starttls_auto: false }
我在注册到我的GitLab实例时尾巴/var/log/mail.log ,并设法看到GitLab实际上与后缀交互,但不成功。 日志build议操作不成功,因为IP被阻塞了,但我不认为这是正确的,因为我可以使用sendmail命令发送邮件。
/var/log/mail.log:
Mar 6 10:58:32 ubuntu postfix/qmgr[12506]: 5BEE724E74: from=<gitlab@ubuntu>, size=630, nrcpt=1 (queue active) Mar 6 10:59:02 ubuntu postfix/smtp[19746]: connect to example.com[93.184.216.34]:25: Connection timed out Mar 6 10:59:02 ubuntu postfix/smtp[19746]: connect to example.com[2606:2800:220:1:248:1893:25c8:1946]:25: Network is unreachable Mar 6 10:59:02 ubuntu postfix/smtp[19746]: 5BEE724E74: to=<[email protected]>, relay=none, delay=30, delays=0.16/0.1/30/0, dsn=4.4.1, status=deferred (connect to example.com[2606:2800:220:1:248:1893:25c8:1946]:25: Network is unreachable) Mar 6 11:00:50 ubuntu postfix/pickup[12505]: 07BF424E7A: uid=999 from=<gitlab@ubuntu> Mar 6 11:00:50 ubuntu postfix/cleanup[19923]: 07BF424E7A: message-id=<[email protected]> Mar 6 11:00:50 ubuntu postfix/qmgr[12506]: 07BF424E7A: from=<gitlab@ubuntu>, size=626, nrcpt=1 (queue active) Mar 6 11:00:51 ubuntu postfix/smtp[19925]: 07BF424E7A: to=<[email protected]>, relay=mta6.am0.yahoodns.net[66.196.118.33]:25, delay=1.1, delays=0.02/0.01/0.86/0.18, dsn=5.7.1, status=bounced (host mta6.am0.yahoodns.net[66.196.118.33] said: 553 5.7.1 [BL21] Connections will not be accepted from 109.65.131.14, because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.html (in reply to MAIL FROM command)) Mar 6 11:00:51 ubuntu postfix/smtp[19925]: 07BF424E7A: lost connection with mta6.am0.yahoodns.net[66.196.118.33] while sending RCPT TO Mar 6 11:00:51 ubuntu postfix/cleanup[19923]: 1A85F24E7C: message-id=<20150306190051.1A85F24E7C@ubuntu> Mar 6 11:00:51 ubuntu postfix/qmgr[12506]: 1A85F24E7C: from=<>, size=2643, nrcpt=1 (queue active) Mar 6 11:00:51 ubuntu postfix/bounce[19929]: 07BF424E7A: sender non-delivery notification: 1A85F24E7C Mar 6 11:00:51 ubuntu postfix/qmgr[12506]: 07BF424E7A: removed
来自gitlab实例的邮件已被您的后缀接受
Mar 6 10:58:32 ubuntu postfix/qmgr[12506]: 5BEE724E74: from=<gitlab@ubuntu>, size=630, nrcpt=1 (queue active)
但是送到目的地不起作用:
Mar 6 10:59:02 ubuntu postfix/smtp[19746]: 5BEE724E74: to=<[email protected]>, relay=none, delay=30, delays=0.16/0.1/30/0, dsn=4.4.1, status=deferred (connect to example.com[2606:2800:220:1:248:1893:25c8:1946]:25: Network is unreachable)
您的服务器尝试使用IPv6,但无法连接。 看来你必须手动禁用IPv6,在main.cf使用这个:
inet_protocols = ipv4
但中继(发送)到雅虎,导致一个错误:
Mar 6 11:00:51 ubuntu postfix/smtp[19925]: 07BF424E7A: to=<[email protected]>, relay=mta6.am0.yahoodns.net[66.196.118.33]:25, delay=1.1, delays=0.02/0.01/0.86/0.18, dsn=5.7.1, status=bounced (host mta6.am0.yahoodns.net[66.196.118.33] said: 553 5.7.1 [BL21] Connections will not be accepted from 109.65.131.14, because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.html (in reply to MAIL FROM command))
它被拒绝,因为您的dynamicIP 109.65.131.14在邮件列表中。 看来你有这个实例在家里,使用一个dynamic的IP。 但是,当这个IP的以前的用户之一尝试发送垃圾邮件时,这些经常在垃圾邮件列表上。 可能需要静态IP(在家中或在其他地方)或使用中继服务器。 并使用适当的FQDN,为IP等设置一个适当的反向DNSlogging(PTR),看看如何不被归类为垃圾邮件的许多其他问题。
由于发送过程失败,未送达通知被发送给发件人
Mar 6 11:00:51 ubuntu postfix/bounce[19929]: 07BF424E7A: sender non-delivery notification: 1A85F24E7C Mar 6 11:00:51 ubuntu postfix/qmgr[12506]: 07BF424E7A: removed
您可能应该阅读您的邮件,回到用户gitlab或configuration为一个pipe理员帐户的别名。
我发现了这个问题。 正如你在日志中看到的那样:
Mar 6 11:00:51 ubuntu postfix/smtp[19925]: 07BF424E7A: to=<[email protected]>, relay=mta6.am0.yahoodns.net[66.196.118.33]:25, delay=1.1, delays=0.02/0.01/0.86/0.18, dsn=5.7.1, status=bounced (host mta6.am0.yahoodns.net[66.196.118.33] said: 553 5.7.1 [BL21] Connections will not be accepted from 109.65.131.14, because the ip is in Spamhaus's list; see http://postmaster.yahoo.com/550-bl23.html (in reply to MAIL FROM command))
它说这个错误是作为对MAIL FROM命令的回复而提出的。 正如你可以在这个日志里看到的那样:
Mar 6 11:00:50 ubuntu postfix/pickup[12505]: 07BF424E7A: uid=999 from=<gitlab@ubuntu>
我的域名是@ubunto ,这是一个不好的域名!
我需要通过将GitLabconfiguration文件中的“external_url”variables从“ http:// ubuntu ”设置为FQDN来更改我的域名。 ( /etc/gitlab/gitlab.rb )