使用 Nullmailer 向 Google(应用)帐户发送邮件会导致“未指定的临时错误”

使用 Nullmailer 向 Google(应用)帐户发送邮件会导致“未指定的临时错误”

使用 Nullmailer 向 Google(应用)帐户发送邮件会导致“未指定的临时错误”

我使用 Google Apps 并且有两个想要使用的帐户:

我如何设置:

  1. 停止空邮件服务
  2. rm /var/log/syslog /var/log/mail.err /var/log/mail.log因为我想在调试 nullmailer 配置时丢弃以前的消息。
  3. apt-get install nullmailer
  4. 编辑/etc/nullmailer/adminaddr后包含:(一行文字和一个换行符)
    [email protected]
    
  5. 编辑“/etc/nullmailer/remotes”以包含(一行文本和一个换行符)
    smtp.gmail.com smtp --port=587 --auth-login [email protected] --pass=thepassword--starttls
    
  6. 重新启动了计算机。

设置完成后我尝试过:

使用以下方式发送一些邮件:

echo "Test 1" | mailq -s "Test one" [email protected]

还可以使用 sendmail 前端:

$ sendmail -v [email protected] <<EOM
> Subject: Test mail four
> The message body
>
> EOM

经过多次尝试,将相关信息以邮件形式发送出去/var/log/syslog/var/log/mail.err如下/var/log/mail.log图所示:

$ cat /var/log/mail.err
Sep  3 14:42:52 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:43:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:44:37  nullmailer[1490]: last message repeated 3 times
Sep  3 14:45:37  nullmailer[1490]: last message repeated 2 times
Sep  3 14:46:37  nullmailer[1490]: last message repeated 2 times
$ cat /var/log/mail.log
Sep  3 14:28:17 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:42:52 cow nullmailer[1490]: Trigger pulled.
Sep  3 14:42:52 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:42:52 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:42:52 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:42:52 cow nullmailer[1490]: Delivery complete, 1 message(s) remain.
Sep  3 14:43:29 cow nullmailer[1490]: Trigger pulled.
Sep  3 14:43:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:43:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:43:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:43:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:43:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:43:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
Sep  3 14:44:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:44:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:44:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:44:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:44:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:44:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
Sep  3 14:45:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:45:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:45:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:45:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:45:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:45:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
Sep  3 14:46:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:46:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:46:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:46:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:46:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:46:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
$ grep nullmailer /var/log/syslog
Sep  3 14:28:17 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:42:52 cow nullmailer[1490]: Trigger pulled.
Sep  3 14:42:52 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:42:52 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:42:52 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:42:52 cow nullmailer[1490]: Delivery complete, 1 message(s) remain.
Sep  3 14:43:29 cow nullmailer[1490]: Trigger pulled.
Sep  3 14:43:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:43:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:43:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:43:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:43:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:43:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
Sep  3 14:44:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:44:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:44:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:44:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:44:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:44:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
Sep  3 14:45:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:45:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:45:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:45:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:45:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:45:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
Sep  3 14:46:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:46:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:46:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:46:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:46:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:46:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.
Sep  3 14:47:29 cow nullmailer[1490]: Rescanning queue.
Sep  3 14:47:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212209.2284
Sep  3 14:47:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:47:29 cow nullmailer[1490]: Starting delivery: protocol: smtp host: smtp.gmail.com file: 1378212171.2280
Sep  3 14:47:29 cow nullmailer[1490]: Sending failed:  Unspecified temporary error
Sep  3 14:47:29 cow nullmailer[1490]: Delivery complete, 2 message(s) remain.

/var/spool/nullmailer/queue/和的内容/var/spool/nullmailer/tmp/

$ ls /var/spool/nullmailer/queue/
1378212171.2280  1378212209.2284
$ ls /var/spool/nullmailer/tmp/
31464  31468  31672

问题

  1. 我在配置中犯了什么明显的错误吗?
  2. “未指定的临时错误”是什么?
  3. 邮件发送过程哪里出错了?
  4. 当我尝试调试这个问题时,我应该如何进行?

答案1

从:http://opensourcehacker.com/2013/03/25/using-nullmailer-and-mandrill-for-your-ubuntu-linux-server-outboud-mail/

  1. 安装 Nullmailer

您希望您的电子邮件通信经过 SSL 加密。Nullmailer 自 1.10 版起支持此功能。Ubuntu 12.04 附带 Nullmailer 1.05-1。要获取适用于 Ubuntu 的最新 Nullmailer,请从我的 Ubuntu PPA 获取(请参阅之前的博客文章,了解我如何将 Nullmailer 反向移植到 Ubuntu 12.04)

注意:这将删除服务器上现有的邮件解决方案。

sudo apt-add-repository ppa:mikko-red-innovation/ppa
sudo apt-get update
sudo apt-get install nullmailer=1:1.11-2~precise1~ppa1

答案2

网上有很多教程建议使用--starttlsraring 的 nullmailer 软件包(12.04)似乎不支持。好像没有编译进去。

排除 nullmailer 故障相当困难,在这种情况下,实际上只记录了“未指定的临时错误”。一个包含故障排除提示的有用页面是诺尔梅勒地雷地图,它帮助我找到了这个问题的根源。

为了得出上述结论,我终止了 nullmailer 守护进程(service nullmailer stop 是一种更好的方法)并手动启动它。它输出unknown option string: '--starttls'(尝试时输出相同--tls)。Nullmailer 使用可执行文件/usr/lib/nullmailer/smtp发送邮件,Ubuntu 12.04 软件包中的版本仅接受以下选项:

root# /usr/lib/nullmailer/smtp -h
usage: smtp [flags] remote-address < mail-file
Send an email message via SMTP
  -p, --port=INT    Set the port number on the remote host to connect to
      --user=VALUE  Set the user name for authentication
      --pass=VALUE  Set the password for authentication
  -d, --daemon      use syslog exclusively
  -s, --syslog      use syslog additionally
      --auth-login  Use AUTH LOGIN instead of AUTH PLAIN in SMTP

  -h, --help        Display this help and exit

这与可能的选择对我来说似乎很稀疏。

结论是,由于编译二进制文件时缺少必要的选项,Nullmailer 包无法与 Google 的 SMTP 服务器一起使用。另一个结论是,Nullmailers 文档及其错误报告都存在缺陷。

答案3

如果 nullmailer 使用 smtp.gmail.com 失败,请尝试直接使用 IPv4 地址:74.125.206.109

我的 /etc/nullmailer/remotes 看起来像这样:

74.125.206.108 smtp --port=465 --auth-login --ssl [email protected] --pass=PASS --insecure

相关内容