我想为我的域名设置一个全面的电子邮件地址。 即(任何发送到[email protected]或[email protected]将发送到特定的邮箱)。 我有Postfix与本地邮件工作,但它拒绝机器的主机名外部的电子邮件。
我遵循这个configuration让它发送所有传入的邮件到一个特定的帐户: http : //www.cyberciti.biz/faq/howto-setup-postfix-catch-all-email-accounts/ 。 当我在同一台机器上发送电子邮件时,它可以正常工作:
paul@server1:~/Maildir/new$ ls -l ~/Maildir/new/ total 0 paul@server1:~/Maildir/new$ echo "test email" | mail -s "test subject" [email protected] paul@server1:~/Maildir/new$ ls -l ~/Maildir/new/ total 4 -rw------- 1 paul paul 2112 Jun 15 19:39 1339774754.V90ceIf21c25M531738.server1 paul@server1:~/Maildir/new$
但是当我尝试从另一个域发送(我将使用Gmail作为例子),我得到一个未交付的通知。

这里是Gmail和本地电话的mail.log:
Jun 15 19:38:40 server1 postfix/pickup[489]: 88ADDF21C35: uid=1000 from=<paul> Jun 15 19:38:40 server1 postfix/cleanup[1909]: 88ADDF21C35: message-id=<[email protected]> Jun 15 19:38:40 server1 postfix/qmgr[490]: 88ADDF21C35: from=<[email protected]>, size=349, nrcpt=1 (queue active) Jun 15 19:38:40 server1 postfix/local[1911]: 88ADDF21C35: to=<[email protected]>, relay=local, delay=0.08, delays=0.05/0.01/0/0.02, dsn=5.1.1, status=bounced (unknown user: "u123456") Jun 15 19:38:40 server1 postfix/cleanup[1909]: 93FDAF21C39: message-id=<[email protected]> Jun 15 19:38:40 server1 postfix/bounce[1912]: 88ADDF21C35: sender non-delivery notification: 93FDAF21C39 Jun 15 19:38:40 server1 postfix/qmgr[490]: 93FDAF21C39: from=<>, size=2096, nrcpt=1 (queue active) Jun 15 19:38:40 server1 postfix/qmgr[490]: 88ADDF21C35: removed Jun 15 19:38:40 server1 postfix/local[1911]: 93FDAF21C39: to=<[email protected]>, relay=local, delay=0.02, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to maildir) Jun 15 19:38:40 server1 postfix/qmgr[490]: 93FDAF21C39: removed Jun 15 19:39:14 server1 postfix/pickup[489]: 7B866F21C35: uid=1000 from=<paul> Jun 15 19:39:14 server1 postfix/cleanup[1909]: 7B866F21C35: message-id=<[email protected]> Jun 15 19:39:14 server1 postfix/qmgr[490]: 7B866F21C35: from=<[email protected]>, size=349, nrcpt=1 (queue active) Jun 15 19:39:14 server1 postfix/local[1911]: 7B866F21C35: to=<[email protected]>, relay=local, delay=0.02, delays=0.01/0/0/0, dsn=5.1.1, status=bounced (unknown user: "u123456") Jun 15 19:39:14 server1 postfix/cleanup[1909]: 7EFA0F21C39: message-id=<[email protected]> Jun 15 19:39:14 server1 postfix/qmgr[490]: 7EFA0F21C39: from=<>, size=2096, nrcpt=1 (queue active) Jun 15 19:39:14 server1 postfix/bounce[1912]: 7B866F21C35: sender non-delivery notification: 7EFA0F21C39 Jun 15 19:39:14 server1 postfix/qmgr[490]: 7B866F21C35: removed Jun 15 19:39:14 server1 postfix/local[1911]: 7EFA0F21C39: to=<[email protected]>, relay=local, delay=0.02, delays=0.01/0/0/0, dsn=2.0.0, status=sent (delivered to maildir) Jun 15 19:39:14 server1 postfix/qmgr[490]: 7EFA0F21C39: removed Jun 15 19:40:02 server1 postfix/pickup[489]: 6EC93F21C39: uid=107 from=<smmsp> Jun 15 19:40:02 server1 postfix/cleanup[1909]: 6EC93F21C39: message-id=<[email protected]> Jun 15 19:40:02 server1 postfix/qmgr[490]: 6EC93F21C39: from=<[email protected]>, size=665, nrcpt=1 (queue active) Jun 15 19:40:02 server1 postfix/local[1911]: 6EC93F21C39: to=<[email protected]>, orig_to=<root>, relay=local, delay=0.11, delays=0.1/0/0/0, dsn=2.0.0, status=sent (delivered to maildir) Jun 15 19:40:02 server1 postfix/qmgr[490]: 6EC93F21C39: removed Jun 15 19:40:53 server1 postfix/smtpd[1975]: connect from mail-wg0-f42.google.com[74.125.82.42] Jun 15 19:40:53 server1 postfix/smtpd[1975]: NOQUEUE: reject: RCPT from mail-wg0-f42.google.com[74.125.82.42]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-wg0-f42.google.com> Jun 15 19:40:54 server1 postfix/smtpd[1975]: disconnect from mail-wg0-f42.google.com[74.125.82.42]
与本地发送不同,目录中没有新的电子邮件。
paul@server1:~/Maildir/new$ ls -l total 4 -rw------- 1 paul paul 2112 Jun 15 19:39 1339774754.V90ceIf21c25M531738.server1 paul@server1:~/Maildir/new$
有没有关于非本地邮件是这样做的? 如何让后缀接受所有用户的邮件并将其放入特定的用户收件箱?
编辑:添加main.cf
paul@server1:~/Maildir/new$ cat /etc/postfix/main.cf # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. myhostname = server1.helpmeco.de alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = helpmeco.de, server1.helpmeco.de, localhost.helpmeco.de, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_command = mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all home_mailbox = Maildir/
弄清楚了。 我在main.cf文件中缺less一些条目:
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, reject virtual_alias_maps = hash:/etc/postfix/virtual local_recipient_maps =
使完整的main.cf:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_reject_unlisted_recipient = no smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, reject # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. myhostname = server1.helpmeco.de alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = helpmeco.de, server1.helpmeco.de, localhost.helpmeco.de, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_command = mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all home_mailbox = Maildir/ virtual_alias_maps = hash:/etc/postfix/virtual local_recipient_maps =