我正在尝试配置sendmail
从 Redmine 安装发送电子邮件(我还没搞清楚如何使用 Apache 运行它)。当我从终端发送邮件时,使用以下命令(示例):
cat some-file | mail -s "some subject" <my-address>@gmail.com
我从地址正确接收了文件内容redmine@custom-domain
。相应的登录/var/log/mail.log
是:
Nov 10 09:06:25 localhost postfix/pickup[24578]: 50A4E65844: uid=107 from=<redmine@custom-domain>
Nov 10 09:06:25 localhost postfix/cleanup[24909]: 50A4E65844: message-id=<20151110090625.50A4E65844@custom-domain>
Nov 10 09:06:25 localhost postfix/qmgr[24579]: 50A4E65844: from=<redmine@custom-domain>, size=3932, nrcpt=1 (queue active)
Nov 10 09:06:25 localhost postfix/smtp[24915]: connect to ASPMX.L.GOOGLE.com[2607:f8b0:400e:c01::1a]:25: Network is unreachable
Nov 10 09:06:25 localhost postfix/smtp[24915]: 50A4E65844: to=<[email protected]>, relay=ASPMX.L.GOOGLE.com[74.125.28.27]:25, delay=0.32, delays=0.01/0/0.14/0.17, dsn=2.0.0, status=sent (250 2.0.0 OK 1447146380 zu2si3894448pbc.115 - gsmtp)
Nov 10 09:06:25 localhost postfix/qmgr[24579]: 50A4E65844: removed
以下是我的redmine配置:
default:
email_delivery:
delivery_method: :sendmail
smtp_settings:
address: localhost
port: 25
authentication: :none
domain: custom-domain
但是当我从 Redmine > 设置 > 电子邮件设置发送测试邮件时,文件中会生成以下日志mail.log
:
Nov 10 09:02:30 localhost postfix/pickup[24578]: 09AD465844: uid=107 from=<redmine@custom-domain>
Nov 10 09:02:30 localhost postfix/cleanup[24888]: 09AD465844: message-id=<[email protected]>
Nov 10 09:02:30 localhost postfix/qmgr[24579]: 09AD465844: from=<redmine@custom-domain>, size=2336, nrcpt=1 (queue active)
Nov 10 09:02:30 localhost postfix/smtp[24890]: 09AD465844: to=<[email protected]>, relay=ASPMX.L.GOOGLE.com[74.125.28.27]:25, delay=0.69, delays=0.01/0/0.5/0.17, dsn=2.0.0, status=sent (250 2.0.0 OK 1447146146 k8si3902958pbq.49 - gsmtp)
Nov 10 09:02:30 localhost postfix/qmgr[24579]: 09AD465844: removed
据我目前所掌握的信息,出现此行为是由于 Redmine 电子邮件中存在以下内容造成的:
message-id=<[email protected]>
我的设置/etc/postfix/main.cf
如下:
myhostname = custom-domain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = custom-domain, localhost, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost
inet_protocols = all
笔记:我也尝试过设置以下内容:
inet_interfaces = all