Ubuntu

Postfix/MySQL:未知使用者錯誤

  • April 25, 2015

我剛剛按照這篇關於使用 Postfix/Dovecot/etc 設置郵件伺服器的優秀教程進行操作。

我通過了它,我可以發送電子郵件就好了。我使用的域是jonah.name. 但是,我無法接收來自外部電子郵件或其他內部郵箱的電子郵件。如果我嘗試向其中的使用者發送電子郵件,我會收到一封“未送達的郵件已退回給發件人”的電子郵件,告訴我該使用者是未知的。這是出現的/var/log/mail.log

Aug 17 21:31:27 localhost postfix/smtpd[810]: connect from gateway09.websitewelcome.com[69.93.179.27]
Aug 17 21:31:28 localhost postfix/trivial-rewrite[816]: warning: do not list domain jonah.name in BOTH mydestination and virtual_mailbox_domains
Aug 17 21:31:28 localhost postgrey[27058]: action=pass, reason=triplet found, client_name=gateway09.websitewelcome.com, client_address=69.93.179.27, sender=jonah@nucleussystems.com, recipient=jonah@jonah.name
Aug 17 21:31:28 localhost postfix/smtpd[810]: 79B1D38947: client=gateway09.websitewelcome.com[69.93.179.27]
Aug 17 21:31:28 localhost postfix/cleanup[819]: 79B1D38947: message-id=<502EB82E.5030406@nucleussystems.com>
Aug 17 21:31:28 localhost postfix/qmgr[732]: 79B1D38947: from=<jonah@nucleussystems.com>, size=1634, nrcpt=1 (queue active)
Aug 17 21:31:28 localhost postfix/smtpd[810]: disconnect from gateway09.websitewelcome.com[69.93.179.27]
Aug 17 21:31:30 localhost postfix/smtpd[826]: connect from remotebox[127.0.0.1]
Aug 17 21:31:30 localhost postfix/trivial-rewrite[816]: warning: do not list domain jonah.name in BOTH mydestination and virtual_mailbox_domains
Aug 17 21:31:30 localhost postfix/smtpd[826]: 622BF3894A: client=remotebox[127.0.0.1]
Aug 17 21:31:30 localhost postfix/cleanup[819]: 622BF3894A: message-id=<502EB82E.5030406@nucleussystems.com>
Aug 17 21:31:30 localhost postfix/smtpd[826]: disconnect from remotebox[127.0.0.1]
Aug 17 21:31:30 localhost postfix/qmgr[732]: 622BF3894A: from=<jonah@nucleussystems.com>, size=2050, nrcpt=1 (queue active)
Aug 17 21:31:30 localhost postfix/trivial-rewrite[816]: warning: do not list domain jonah.name in BOTH mydestination and virtual_mailbox_domains
Aug 17 21:31:30 localhost amavis[30938]: (30938-10) Passed CLEAN, [69.93.179.27] <jonah@nucleussystems.com> -> <jonah@jonah.name>, Message-ID: <502EB82E.5030406@nucleussystems.com>, mail_id: jbjlO+jljnPM, Hits: -0.001, size: 1634, queued_as: 622BF3894A, 1855 ms
Aug 17 21:31:30 localhost postfix/smtp[821]: 79B1D38947: to=<jonah@jonah.name>, relay=127.0.0.1[127.0.0.1]:10024, delay=2.3, delays=0.41/0.01/0/1.9, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 622BF3894A)
Aug 17 21:31:30 localhost postfix/qmgr[732]: 79B1D38947: removed
Aug 17 21:31:30 localhost postfix/local[827]: 622BF3894A: to=<jonah@jonah.name>, relay=local, delay=0.02, delays=0/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "jonah")
Aug 17 21:31:30 localhost postfix/cleanup[819]: 65CAF38953: message-id=<20120817213130.65CAF38953@jonah.name>
Aug 17 21:31:30 localhost postfix/bounce[828]: 622BF3894A: sender non-delivery notification: 65CAF38953
Aug 17 21:31:30 localhost postfix/qmgr[732]: 65CAF38953: from=<>, size=3832, nrcpt=1 (queue active)
Aug 17 21:31:30 localhost postfix/qmgr[732]: 622BF3894A: removed
Aug 17 21:31:30 localhost postfix/smtp[829]: 65CAF38953: to=<jonah@nucleussystems.com>, relay=mail.nucleussystems.com[50.116.72.68]:25, delay=0.46, delays=0/0.01/0.33/0.11, dsn=2.0.0, status=sent (250 OK id=1T2U8g-0008VP-Qb)
Aug 17 21:31:30 localhost postfix/qmgr[732]: 65CAF38953: removed

日誌確認(第 18 行)使用者是“未知的”。我重新檢查了所有連接到 MySQL 的配置文件,但我找不到任何缺陷。以下是 MySQL 虛擬配置文件:

# /etc/postfix/mysql_virtual_alias_domainaliases_maps.cf

user = mail
password = **password**
hosts = 127.0.0.1
dbname = mail
query = SELECT goto FROM alias,alias_domain
 WHERE alias_domain.alias_domain = '%d'
 AND alias.address=concat('%u', '@', alias_domain.target_domain)
 AND alias.active = 1

# /etc/postfix/mysql_virtual_alias_maps.cf

user = mail
password = **password**
hosts = 127.0.0.1
dbname = mail
table = alias
select_field = goto
where_field = address
additional_conditions = and active = '1'

# /etc/postfix/mysql_virtual_domain_maps.cf

user = mail
password = **password**
hosts = 127.0.0.1
dbname = mail
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '0' and active = '1'

# /etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf

user = mail
password = **password**
hosts = 127.0.0.1
dbname = mail
query = SELECT maildir FROM mailbox, alias_domain
 WHERE alias_domain.alias_domain = '%d'
 AND mailbox.username=concat('%u', '@', alias_domain.target_domain )
 AND mailbox.active = 1

# /etc/postfix/mysql_virtual_mailbox_maps.cf

user = mail
password = **password**
hosts = 127.0.0.1
dbname = mail
table = mailbox
select_field = CONCAT(domain, '/', local_part)
where_field = username
additional_conditions = and active = '1'

上面的日誌中沒有答案嗎?“警告:不要在 mydestination 和 virtual_mailbox_domains 中列出域 jonah.name”

編輯 :

嘗試“mydestination = localhost”

“mydestination:通過 $local_transport 郵件傳遞傳輸傳遞的域列表。” 即 postfix 試圖找到一個名為 jonah 的真實使用者。根據您的設置,您希望使用者 jonah 是虛擬的,因此 jonah.name 不能是 mydestination 的一部分(我同意,這很棘手)。

看起來發件人被列入灰名單,如果發件人在大約 300 秒後重試,它應該會通過。您還可以禁用灰名單。

引用自:https://serverfault.com/questions/418766