Как мне настроить Postfix, чтобы принимать всю электронную почту и отправлять на определенный адрес?
Я хочу установить универсальный адрес электронной почты для моего домена. т.е. (все, что отправлено на [email protected] или [email protected], будет отправлено в определенный почтовый ящик). У меня есть Postfix, работающий с локальной почтой, но он отклоняет электронные письма вне имени хоста машины.
Я следовал этой конфигурации, чтобы заставить ее отправлять всю входящую почту на конкретную учетную запись: 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), я получаю уведомление о недоставке.
вот mail.log для gmail и локального звонка:
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$
Есть ли что-то в не локальной почте, которая делает это? Как заставить postfix принимать всю почту всем пользователям и помещать ее в почтовый ящик определенного пользователя?
РЕДАКТИРОВАТЬ: добавление 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/
1 ответ
Догадаться . Мне не хватало некоторых записей в моем файле main.cf:
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 =