这是我关于 Stacks 的第一个问题。我几乎每隔一天就会在这里阅读很多问题的解决方案。所以感谢所有贡献者。我是这里的菜鸟,所以如果我做错了什么,请留出一些空间。我的问题是
我正在尝试将 Postfix 服务器设置为仅用于多个域名的 SMTP 主机。我不允许远程连接我只想能够使用我的 cron 脚本为各种域发送电子邮件。目前 Postfix 是默认安装,但我添加了
myhostname=example.com
Run Code Online (Sandbox Code Playgroud)
现在的问题是,如果我从 email@example2.com 发送电子邮件,则电子邮件标题中显示的主机(不在发件人地址中)是 example.com,确切的标题是
Received: from example.com
Run Code Online (Sandbox Code Playgroud)
我的发件人地址是正确的。请原谅我,但我真的不太了解电子邮件服务器。我的传入由另一个托管服务提供商处理,我知道我需要添加反向 dns 等。所以请如果有人知道我应该做什么,那么所有域都有正确的 DNS 条目以及良好的后缀配置。我希望 postfix 使用与发件人地址相同的域名。我只需要 smtp 而没有别的。
我已经搜索了 google 和 Stacks,但即使问题相似,也没有人完全回答这个问题。
在此先感谢,我仍然到处都是 RTFM。
我的邮件日志中也出现了这些错误。我用 MYDOMAIN 替换了一个真正有效的域名,用 USER 替换了一个真实的系统用户名
Feb 14 22:53:13 li222-89 postfix/smtpd[28433]: connect from localhost[127.0.0.1]
Feb 14 22:53:13 li222-89 postfix/smtpd[28433]: 428FCA400C: client=localhost[127.0.0.1]
Feb 14 22:53:13 li222-89 postfix/cleanup[28436]: 428FCA400C: message-id=<4d59f8a8-0ab4-4aee-b6e6-6f0c9389ad7c@>
Feb 14 22:53:13 li222-89 postfix/qmgr[27293]: 428FCA400C: from=<noreply@MYDOMAIN.net>, size=1047, nrcpt=1 (queue active)
Feb 14 22:53:13 li222-89 postfix/smtpd[28433]: disconnect from localhost[127.0.0.1]
Feb 14 22:53:13 li222-89 postfix/smtp[27755]: certificate verification failed for gmail-smtp-in.l.google.com: num=20:unable to get local issuer certificate
Feb 14 22:53:13 li222-89 postfix/smtp[27755]: certificate verification failed for gmail-smtp-in.l.google.com: num=27:certificate not trusted
Feb 14 22:53:13 li222-89 postfix/pickup[26953]: C3761A400D: uid=500 from=<USER>
Feb 14 22:53:13 li222-89 postfix/cleanup[28436]: C3761A400D: message-id=<20110215035313.C3761A400D@example.net>
Feb 14 22:53:13 li222-89 postfix/qmgr[27293]: C3761A400D: from=<USER@net.net>, size=3237, nrcpt=1 (queue active)
Feb 14 22:53:14 li222-89 postfix/smtp[26830]: certificate verification failed for aspmx.l.google.com: num=20:unable to get local issuer certificate
Feb 14 22:53:14 li222-89 postfix/smtp[26830]: certificate verification failed for aspmx.l.google.com: num=27:certificate not trusted
Feb 14 22:53:15 li222-89 postfix/smtp[27755]: 428FCA400C: to=<somebodysomebody@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.155.27]:25, delay=2.6, delays=0.02/0.02/0.66/1.9, dsn=2.0.0, status=sent (250 2.0.0 OK 1297741995 l9si6487318yhl.10)
Feb 14 22:53:15 li222-89 postfix/qmgr[27293]: 428FCA400C: removed
Feb 14 22:53:17 li222-89 postfix/smtp[26830]: C3761A400D: to=<USER@net.net>, orig_to=<USER>, relay=aspmx.l.google.com[74.125.155.27]:25, delay=14, delays=11/0/0.44/3.1, dsn=5.1.1, status=bounced (host aspmx.l.google.com[74.125.155.27] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 http://mail.google.com/support/bin/answer.py?answer=6596 hj39si8560308ibb.50 (in reply to RCPT TO command))
Feb 14 22:53:17 li222-89 postfix/cleanup[28436]: 726DFA400C: message-id=<20110215035317.726DFA400C@example.net>
Feb 14 22:53:17 li222-89 postfix/qmgr[27293]: 726DFA400C: from=<>, size=5596, nrcpt=1 (queue active)
Feb 14 22:53:17 li222-89 postfix/bounce[28222]: C3761A400D: sender non-delivery notification: 726DFA400C
Feb 14 22:53:17 li222-89 postfix/qmgr[27293]: C3761A400D: removed
Feb 14 22:53:17 li222-89 postfix/smtp[27755]: certificate verification failed for aspmx.l.google.com: num=20:unable to get local issuer certificate
Feb 14 22:53:17 li222-89 postfix/smtp[27755]: certificate verification failed for aspmx.l.google.com: num=27:certificate not trusted
Feb 14 22:53:21 li222-89 postfix/smtp[27755]: 726DFA400C: to=<USER@net.net>, relay=aspmx.l.google.com[74.125.155.27]:25, delay=3.6, delays=0.02/0.01/0.44/3.1, dsn=5.1.1, status=bounced (host aspmx.l.google.com[74.125.155.27] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 http://mail.google.com/support/bin/answer.py?answer=6596 mu18si8573893ibb.7 (in reply to RCPT TO command))
Feb 14 22:53:21 li222-89 postfix/qmgr[27293]: 726DFA400C: removed
Run Code Online (Sandbox Code Playgroud)
显然,它试图将电子邮件发送到 gmail 帐户,但出了点问题......真的错了。
我相信这就是你想要的。
http://www.postfix.org/ADDRESS_REWRITING_README.html#generic
例子:
/etc/postfix/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic
/etc/postfix/generic:
his@localdomain.local hisaccount@hisisp.example
her@localdomain.local heraccount@herisp.example
@localdomain.local hisaccount+local@hisisp.example
Run Code Online (Sandbox Code Playgroud)
所以,如果你已经安装并配置了 postfix。
打开 main.cf 并添加上面的通用地图设置。
然后打开通用文件并添加 @example.com @example2.com 或您的环境所需的任何设置
这是一个哈希文件,所以当你完成后运行postmap /etc/postfix/generic
然后重新启动postfix。
更新
看起来这实际上就是您所追求的。
编辑 master cf 文件并更改此行
smtp inet n - n - - smtpd
Run Code Online (Sandbox Code Playgroud)
到:
localhost:smtp inet n - n - - smtpd
ipaddress1:smtp inet n - n - - smtpd
ipaddress2:smtp inet n - n - - smtpd -o myhostname=hostname2
.
.
.
ipaddressn:smtp inet n - n - - smtpd -o myhostname=hostname3
Run Code Online (Sandbox Code Playgroud)
重新启动后缀
显然,这需要您设置多个 IP 地址,每个域一个,并设置反向 DNS 等。我相信这是唯一的方法。
归档时间: |
|
查看次数: |
14767 次 |
最近记录: |