我想设置Exim通过我的Gmail(实际上我的域谷歌应用程序)发送邮件。
我已经添加了路由器,传输和身份validation器。 特别:
gmail_route: driver = manualroute transport = gmail_relay route_list = * smtp.gmail.com gmail_relay: driver = smtp port = 587 hosts_require_auth = $host_address hosts_require_tls = $host_address gmail_login: driver = plaintext public_name = LOGIN hide client_send = :[email protected]:mypassword
我可以在Debian上设置Exim,但我无法在Centos上find它。
当我在监视日志的时候尝试发送,告诉我“没有findIP地址…”,然后是“远程邮件服务器的SMTP错误…”。 它还说“需要validation”。
这里有更多的细节:假装我发送到[email protected]
[email protected] R=gmail_route T=gmail_relay: SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1492: host gmail-smtp-msa.l.google.com [2a00:1450:4001:c02::6d]: 530-5.5.1 Authentication Required. Learn more at\n530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 k41sm12066343een.19 - gsmtp
有什么我可以尝试解决这个问题吗? 我打算主要使用它发送警报邮件给自己(fail2ban,logwatch等)。 而默认的Exim设置似乎工作,但我宁愿使用我的gapps电子邮件,如[email protected] – 一方面,电子邮件去垃圾邮件之前,我训练我的电子邮件帐户,把他们在收件箱中…
谢谢,
我已经使用了以下configuration
路由器
send_via_gmail: driver = manualroute domains = ! +local_domains transport = gmail_smtp route_list = * smtp.gmail.com
运输
gmail_smtp: driver = smtp port = 587 hosts_require_auth = $host_address hosts_require_tls = $host_address
AUTHENTICATOR
gmail_login: driver = plaintext public_name = LOGIN client_send = : [email protected] : 7654321
一些简单的testing
# swaks -s 127.0.0.1 --to [email protected] --from [email protected] === Trying 127.0.0.1:25... === Connected to 127.0.0.1. <- 220 mail.example.net, [127.0.0.1] -> EHLO mail.example.net <- 250-mail.example.net Hello localhost [127.0.0.1] <- 250-SIZE 52428800 <- 250-PIPELINING <- 250-STARTTLS <- 250 HELP -> MAIL FROM:<[email protected]> <- 250 OK -> RCPT TO:<[email protected]> <- 250 Accepted -> DATA <- 354 Enter message, ending with "." on a line by itself -> Date: Wed, 05 Mar 2014 10:22:55 -0500 -> To: [email protected] -> From: [email protected] -> Subject: test Wed, 05 Mar 2014 10:22:55 -0500 -> X-Mailer: swaks v20130209.0 jetmore.org/john/code/swaks/ -> -> This is a test mailing -> -> . <- 250 OK id=1WLDep-0004ED-Kb -> QUIT <- 221 mail.example.net closing connection === Connection closed with remote host.
检查maillog文件
# cat /var/log/exim/main.log | grep 1WLDep-0004ED-Kb 2014-03-05 10:22:55 1WLDep-0004ED-Kb <= [email protected] H=localhost (mail.example.net) [127.0.0.1] P=esmtp S=479 2014-03-05 10:22:55 1WLDep-0004ED-Kb gmail-smtp-msa.l.google.com [2a00:1450:4001:c02::6d] Network is unreachable 2014-03-05 10:23:00 1WLDep-0004ED-Kb => [email protected] R=send_via_gmail T=gmail_smtp H=gmail-smtp-msa.l.google.com [173.194.70.108] X=UNKNOWN:ECDHE-RSA-AES128-GCM-SHA256:128 2014-03-05 10:23:00 1WLDep-0004ED-Kb Completed
您可以在debugging模式下运行exim
# echo -e "helo localhost\nmail from:<[email protected]>\nrcpt to:<[email protected]>\nDATA\nHello world\n.\nquit" | exim -bhc 127.0.0.1 -d+all
之后,你会得到很多数据。 将输出添加到问题
你试过这个吗?
使用GMail作为智能主机:
注意:必须将以下内容放在configuration文件的相应部分中,例如,在开始authentication者之后。
在dnslookup路由器之前或之中添加路由器:
gmail_route:driver = manualroute transport = gmail_relay route_list = * smtp.gmail.com
添加运输:
gmail_relay:driver = smtp port = 587 hosts_require_auth = $ host_address hosts_require_tls = $ host_address
添加一个身份validation器(用您自己的账户信息[email protected]和mypassword):
gmail_login:driver = plaintext public_name = LOGIN隐藏client_send =:[email protected]:mypassword
$ host_address用于hosts_require_auth和hosts_require_tls,而不是smtp.gmail.com,以避免偶尔发生的错误。 这些是由smtp.gmail.com的DNS查询中IP地址的变化引起的。 $ host_address将展开到由gmail_route路由器parsing的特定IP地址。 为了增加安全性,请使用每个应用程序的密码。 这也适用于Google Apps帐户。
消息来源: https : //wiki.archlinux.org/index.php/Exim_with_Remote_SMTP_server
您需要将hosts_require_auth和hosts_require_tls选项更改为以下内容:
hosts_require_auth = <; $host_address hosts_require_tls = <; $host_address
使用IPv6发送时会发生此问题。 使用IPv6发送时, $host_address将是一个IPv6地址,因此将包含冒号( $host_address 。 冒号通常用作Exim中的列表分隔符,所以地址匹配失败,Exim不会validation自己。
用<;前缀列表 将列表分隔符更改为分号并防止IPv6地址出现问题。