运维开发网

电子邮件 – Centos上的Exim – 配置gmail smtp

运维开发网 https://www.qedev.com 2020-05-08 17:58 出处:网络 作者:运维开发网整理
我想设置Exim通过我的Gmail发送邮件(实际上是我的域名谷歌应用程序). 我添加了路由器,传输和身份验证器.特别:
我想设置Exim通过我的Gmail发送邮件(实际上是我的域名谷歌应用程序).

我添加了路由器,传输和身份验证器.特别:

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 = :me@domain.com:mypassword

我能够在Debian上为Exim设置这个,但我无法在Centos上找到它.

当我在监视日志时尝试发送时,它告诉我“没有找到IP地址……”然后“远程邮件服务器发送SMTP错误…”.它还说“需要身份验证”.

这里有更多细节:假装我发送给someone@gmail.com

someone@gmail.com R=gmail_route T=gmail_relay: SMTP error from remote mail server after MAIL FROM:<me@domain.com> 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电子邮件,如hostname@mydomain.com – 一方面,在我训练我的电子邮件帐户将电子邮件放入收件箱之前,电子邮件发送到垃圾邮件…

谢谢,

我使用了以下配置

路由器

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 = : alex.hha@gmail.com : 7654321

一些简单的测试

# swaks -s 127.0.0.1 --to user@example.net --from alex.hha@gmail.com
=== 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:<alex.hha@gmail.com>
<-  250 OK
 -> RCPT TO:<user@example.net>
<-  250 Accepted
 -> DATA
<-  354 Enter message, ending with "." on a line by itself
 -> Date: Wed, 05 Mar 2014 10:22:55 -0500
 -> To: user@example.net
 -> From: alex.hha@gmail.com
 -> 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 <= alex.hha@gmail.com 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 => user@example.net 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

您可以在调试模式下运行exim

# echo -e "helo localhost\nmail from:<me@domain.com>\nrcpt to:<someone@gmail.com>\nDATA\nHello world\n.\nquit" | exim -bhc 127.0.0.1 -d+all

之后你会获得大量数据.将输出添加到问题中

0

精彩评论

暂无评论...
验证码 换一张
取 消