尝试使用Sendmail设置Catch-All电子邮件地址

时间:2016-11-28 17:29:35

标签: email amazon-ec2 sendmail

我尝试使用Sendmail创建一个垃圾邮件地址(它将用于捕获Oceth's OEMPro的电子邮件退回)。

首先,我开始创建一个新用户:

# useradd -s /bin/false bounces
# passwd bounces

然后我创造了&用vim virtusertable打开了一个虚拟文件,并添加了:

bounces@sub.example.com bounces
@sub.example.com    bounces@sub.example.com

然后我将以下行添加到 sendmail.mc 附近,但在MAILER_DEFINITIONS之前

FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl

最后,我跑了

# make
Updating databases ...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...
Updating auth ...
sasl2-bin not installed, not configuring sendmail support.

To enable sendmail SASL2 support at a later date, invoke "/usr/share/sendmail/update_auth"

Creating /etc/mail/relay-domains
# Optional file...
Updating Makefile ...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/Makefile...
Updating sendmail.cf ...
The following file(s) have changed:
  /etc/mail/sendmail.cf
** ** You should issue `/etc/init.d/sendmail reload` ** **
# service sendmail reload
 * Reloading Mail Transport Agent (MTA) sendmail                                                                                                                           [ OK ] 
# service sendmail restart
 * Restarting Mail Transport Agent (MTA) sendmail                                                                                                                          [ OK ]

毕竟这似乎不起作用,我该怎样才能正确测试。我已经尝试向bounces@sub.example.com发送电子邮件,但当我查看 / var / mail / 时,我看不到跳出用户。

# ls /var/mail/
root  www-data  other-user

我也为此创建了一个MX DNS记录,例如sub.example.com。

另一个指示它无法正常工作的是,当我们尝试将此电子邮件地址用作Oceth's OEMPro中的POP3监控方法时,我们收到504错误。 enter image description here

更新

我尝试以root身份运行以下命令,试图调试问题,但我不清楚它告诉我的是什么。

root:/# sendmail -d60.5 -bv no-such-user@sub.example.com
map_lookup(dequote, other-user, %0=other-user) => NOT FOUND (0)
map_lookup(host, sub.example.com, %0=sub.example.com) => sub.example.com. (0)
no-such-user@sub.example.com... deliverable: mailer esmtp, host sub.example.com., user no-such-user@sub.example.com
root:/# sendmail -d60.5 -bv bounces@sub.example.com
map_lookup(dequote, other-user, %0=other-user) => NOT FOUND (0)
map_lookup(host, sub.example.com, %0=sub.example.com) => sub.example.com. (0)
bounces@sub.example.com... deliverable: mailer esmtp, host sub.example.com., user bounces@sub.example.com

我不确定为什么它首先尝试在名为other-user的系统中查找其他用户

更新2

运行# echo '$=w' | sendmail -bt后,我得到以下结果。

# echo '$=w' | sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> localhost
ip-1??-??-??-??5
[1??.??.??.??5]
ip-1??-??-??-??5.ec2.internal
[127.0.0.1]
ip-172-31-31-167.eu-west-1.compute.internal

sendmail.mc 中,我已将FEATURE( virtusertable&#39;,hash -o /etc/mail/virtusertable.db')dnl更改为FEATURE( virtusertable&#39;,{{1} },基本上我刚刚删除了hash -o /etc/mail/virtusertable.db')dnl标志。

然后我更新了 / etc / mail / local-host-names 以包含-o,现在它显示为:

sub.example.com

然后我跑了:

localhost
ip-17?-??-??-?67.eu-west-1.compute.internal
sub.example.com

发送电子邮件至bunces@sub.example.com后,我仍然看不到 / var / mail /

中的邮箱
# service sendmail restart
 * Restarting Mail Transport Agent (MTA) sendmail 
# echo '$=w' | sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> localhost
ip-1??-??-??-??5
[1??.??.??.??5]
ip-1??-??-??-??5.ec2.internal
[127.0.0.1]
sub.example.com
ip-17?-??-??-?67.eu-west-1.compute.internal

当我尝试使用这些设置配置时,我仍然在OEMPro应用程序中收到504错误。

1 个答案:

答案 0 :(得分:2)

Sendmail只会向本地电子邮件域(在$=w中列出)和虚拟域(在$={VirtHost}中列出)提供virtusertable。似乎sub.example.com未列入其中任何一个。

您可以将sub.example.com添加到本地电子邮件域列表中,方法是将其列在文件/etc/mail/local-host-names中(每行一个域/名称)。修改文件后,重启sendmail守护程序发送HUP信号给sendmail守护程序。

您可以通过以root身份执行以下命令来检查$=w的内容:
echo '$=w' | sendmail -bt

默认情况下,Sendmail会自动添加一些&#34; guesswork&#34;到$=w

额外提示
请勿在{{1​​}}中使用-o(可选)标记。如果没有标志,当编译版本的virtusertable无可用时,sendmail就会拒绝启动。