无法获得exim4和gmail的工作

我一直在关注如何通过exim和我的Gmail帐户从ubuntu服务器发送电子邮件的各种指南。 我认为我已经在这个区块上多次出现过,所以我已经把它搞砸了。 任何人都可以看到什么是不对的?

我不想在此论坛post中包含任何真实的电子邮件地址或域名,所以无论何时出现在configuration文件中,我都会按如下方式将它们交换出去。 我将使用愚蠢的名字,而不是描述性的名字,所以他们不会混淆了系统variables等

domain name for the server: bigspanners.com username i'm logged into the server as: jimmy hostname on the server: spanners "long" hostname (result of `hostname -f`): spanners.bigspanners.com the gmail address i want to send from: [email protected] gmail password: abcdefgh 

我的exim4configuration( /etc/exim4/update-exim4.conf.conf )如下所示:

 #/etc/exim4/update-exim4.conf.conf dc_eximconfig_configtype='smarthost' dc_other_hostnames='' dc_local_interfaces='127.0.0.1 ; ::1' dc_readhost='bigspanners.com' dc_relay_domains='' dc_minimaldns='false' dc_relay_nets='' dc_smarthost='smtp.gmail.com::587' CFILEMODE='644' dc_use_split_config='true' dc_hide_mailname='false' dc_mailname_in_oh='true' dc_localdelivery='mail_spool' 

我在/etc/exim4/passwd.client文件中有这个:

 # password file used when the local exim is authenticating to a remote # host as a client. # # see exim4_passwd_client(5) for more documentation # # Example: ### target.mail.server.example:login:password gmail-smtp.l.google.com:[email protected]:abcdefgh *.google.com:[email protected]:abcdefgh smtp.gmail.com:[email protected]:abcdefgh 

我有/etc/email-addresses

 # This is /etc/email-addresses. It is part of the exim package # # This file contains email addresses to use for outgoing mail. Any local # part not in here will be qualified by the system domain as normal. # # It should contain lines of the form: # #user: [email protected] #otheruser: [email protected] jimmy: [email protected] jimmy@localhost: [email protected] jimmy@hostname1: [email protected] [email protected]: [email protected] 

我正尝试发送一封电子邮件,如下所示:

 echo "This is a test." | mail -s Testing [email protected] 

我在/var/log/exim4/mainlog文件中看到了这个:

 2014-04-16 13:57:50 1WaQLW-0002dC-9k <= [email protected] U=jimmy P=local S=445 2014-04-16 13:57:51 1WaQLW-0002dC-9k plain authenticator failed H=gmail-smtp-msa.l.google.com [173.194.64.108] 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsuj 534-5.7.14 B3VqEmiHZ1icpT_O185MznNwotW78A3DdsElZPGAkfsIWQdd5de1lNbXoR-xdqK5Ko_Rs5 534-5.7.14 8zXBl2vzfUDPSF08dULZVaF8z999DpQNslK02DfEG0YcTUOxLqoosEzuxHA1vG-_bIxi9L 534-5.7.14 hMsYKcMkWJ7g4wf4xG-LK6c1sKQhFx-u1zcsUyLykkzI1qtGXYF5NC-ZpdnALCdQZ3hzUh 534-5.7.14 aAoXTLg> Please log in via your web browser and then try again. 534-5.7.14 Learn more at https://support.google.com/mail/bin/answer.py?answer=787 534 5.7.14 54 tz6sm39939105obc.10 - gsmtp 2014-04-16 13:57:51 1WaQLW-0002dC-9k login authenticator failed H=gmail-smtp-msa.l.google.com [173.194.64.108] 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbvT4 534-5.7.14 CHLiBFGLWWXIojohtPd9cIM1vLOt1MMyjSUzcFdXOarqE18FzPPxmU9e32_CveJOax5nnB 534-5.7.14 _7-adgi6NtHxbChOOxjRpd8xZCLgNnSjiHFWcbYeLLCZbv-7l6zylE7poh8nFe7SgTEINk 534-5.7.14 Lx1XvFQH1RuA1HJCwsC6nC-jG_4HQF7TY8ma9PBJWv4gz9fNna7wZFX4eeWtFTgpg7dKrX 534-5.7.14 wGYmwwQ> Please log in via your web browser and then try again. 534-5.7.14 Learn more at https://support.google.com/mail/bin/answer.py?answer=787 534 5.7.14 54 tz6sm39939105obc.10 - gsmtp 2014-04-16 13:57:51 1WaQLW-0002dC-9k ** [email protected] R=smarthost T=remote_smtp_smarthost: SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1480: host gmail-smtp-msa.l.google.com [173.194.64.108]: 530-5.5.1 Authentication Required. Learn more at\n530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 tz6sm39939105obc.10 - gsmtp 2014-04-16 13:57:51 1WaQLX-0002dT-QM <= <> R=1WaQLW-0002dC-9k U=Debian-exim P=local S=1595 2014-04-16 13:57:51 1WaQLW-0002dC-9k Completed 2014-04-16 13:57:52 1WaQLX-0002dT-QM plain authenticator failed H=gmail-smtp-msa.l.google.com [173.194.64.108] 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbt1l 534-5.7.14 LT1ysO4nisev9cFYPlQZ0Lk_Y0VvwVmgOWTJOEbZzYo5JOP9vMCoh-wwEXhq-8pUkhKejG 534-5.7.14 KRUNECT5VykeH6TSNQ8MR8ZoXe36ZZhpiZXCr0Smbjq512Lq_D5tozz9A9o1_JQePR05w6 534-5.7.14 RjyOK481V2Th6RhKwKqlBsvxfWKbs7twgxyklxBTRihFUEkJpFXDzvWNfUNJhkQq0MJnHv 534-5.7.14 53T4KeQ> Please log in via your web browser and then try again. 534-5.7.14 Learn more at https://support.google.com/mail/bin/answer.py?answer=787 534 5.7.14 54 sm4sm23756569obc.3 - gsmtp 2014-04-16 13:57:53 1WaQLX-0002dT-QM login authenticator failed H=gmail-smtp-msa.l.google.com [173.194.64.108] 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbt09 534-5.7.14 0DeijxwxzvClKfwY3oc1IhhkdSt_3suNtEsij4ibdikNtCMCiogd6mOma3obSAu2J5PlVh 534-5.7.14 QnZAN8CalbSYOX7mzuQyVqErqsY9uv5yuObmXk8771WBGrOzIxaOTnzChpd_ZVVeSGfmnh 534-5.7.14 qU5KHUrFo-qvHuYuqNZ1IsnbCkDKpov095uSs9wsbqA2WDEIKMI97EScrbjSNTJ35gdzOx 534-5.7.14 D_2ZhLA> Please log in via your web browser and then try again. 534-5.7.14 Learn more at https://support.google.com/mail/bin/answer.py?answer=787 534 5.7.14 54 sm4sm23756569obc.3 - gsmtp 2014-04-16 13:57:53 1WaQLX-0002dT-QM ** [email protected] R=smarthost T=remote_smtp_smarthost: SMTP error from remote mail server after MAIL FROM:<> SIZE=2655: host gmail-smtp-msa.l.google.com [173.194.64.108]: 530-5.5.1 Authentication Required. Learn more at\n530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 sm4sm23756569obc.3 - gsmtp 2014-04-16 13:57:53 1WaQLX-0002dT-QM Frozen (delivery error message) 2014-04-16 14:00:13 1WaQNg-0002eG-NX <= [email protected] U=jimmy P=local S=2381 2014-04-16 14:00:13 1WaQNg-0002eG-NX == jimmy@localhost R=local_user T=mail_spool defer (13): Permission denied: creating lock file hitching post /var/mail/jimmy.lock.spanners.bigspanners.com.534e8ced.000027cc (euid=1000 egid=8) 

对不起,这篇文章的长度,但我想提供任何信息,我认为可能是相关的。 任何人都可以看到有什么不对?

编辑:我只是想其他可能相关的东西:我有iptables设置为允许所有传出的请求,但阻止所有传入的请求期望在白名单上的人。 我不知道gmail auth是如何工作的:它可能是auth进程的一部分被阻止,因为它进入一个非白名单端口,这就是为什么它失败了? 这是我的iptables规则:

 Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere REJECT all -- anywhere 127.0.0.0/8 reject-with icmp-port-unreachable ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT tcp -- anywhere anywhere tcp dpt:https ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:24367 ACCEPT icmp -- anywhere anywhere icmp echo-request ACCEPT tcp -- anywhere anywhere tcp dpt:2812 LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix `iptables denied: ' REJECT all -- anywhere anywhere reject-with icmp-port-unreachable Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-port-unreachable Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere tcp dpt:2812 

编辑2:自发布以来,我已经从Gmail的通知说:“有人试图访问您的电子邮件帐户,是你? (或者单词),列出我的服务器的IP地址。 我点击了“是的,那是我”的框,然后再试一次,但是仍然不起作用。

现在几个小时都有同样的问题,但它不是谷歌configuration阻止帐户访问,因为你尝试从一个其他的IPlogin,然后正常。

打开http://www.google.com/accounts/DisplayUnlockCaptcha ,然后尝试发送电子邮件,例如:echo'My Test Text'| mail -s Testmail [email protected]

/etc/exim4/passwd.client

 # password file used when the local exim is authenticating to a remote # host as a client. # # see exim4_passwd_client(5) for more documentation # # Example: ### target.mail.server.example:login:password gmail-smtp.l.google.com:[email protected]:yourpassword *.google.com:[email protected]:yourpassword smtp.gmail.com:[email protected]:yourpassword 

/etc/exim4/update-exim4.conf.conf

 # /etc/exim4/update-exim4.conf.conf # (...) # This is a Debian specific file dc_eximconfig_configtype='satellite' dc_other_hostnames='ServerName' dc_local_interfaces='127.0.0.1 ; ::1' dc_readhost='yourdomain_which_points_to_server.com' dc_relay_domains='' dc_minimaldns='false' dc_relay_nets='' dc_smarthost='smtp.gmail.com::587' CFILEMODE='644' dc_use_split_config='false' dc_hide_mailname='true' dc_mailname_in_oh='true' dc_localdelivery='mail_spool' 

如果协商没有正确完成,Gmail身份validation将失败。 在与Gmail通话时检查确实使用了starttls。 你可以用-d-all + tls + transport运行exim。

这应该给更多的信息