Email

Postfix 不接收來自本地主機外部的郵件

  • July 30, 2020

我在我的 Parabola(基於 Arch)安裝中設置了 Postfix + Dovecot。看起來它可以工作,我可以向任何地址發送電子郵件並且它可以工作,並且還可以接收郵件**,但只能來自本地地址**。

如果我這樣做mail my@domain.org了,我會收到電子郵件(例如自動向我發送電子郵件)。但是,如果我從另一個電子郵件帳戶(外部帳戶)發送郵件,我根本就不會收到它。

所有埠都在本地工作,但如果我嘗試telnet [my_public_IP] 25(或 587)它會失敗(我會問我的 ISP 發生了什麼)。

更多輸出:

$ postconf -n
alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/bin
compatibility_level = 2
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Maildir/
html_directory = no
inet_interfaces = localhost # I've tried using my IP address, with no luck
inet_protocols = all
mail_owner = postfix
mailbox_size_limit = 134217728
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
message_size_limit = 134217728
meta_directory = /etc/postfix
mydomain = eumela.ga
myhostname = smtp.eumela.ga
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix
sample_directory = /etc/postfix
sendmail_path = /usr/bin/sendmail
setgid_group = postdrop
shlib_directory = /usr/lib/postfix
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/letsencrypt/live/eumela.ga/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/eumela.ga/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
unknown_local_recipient_reject_code = 550
virtual_alias_domains = $mydomain
virtual_alias_maps = hash:/etc/postfix/virtual

$ cat /etc/dovecot/dovecot.conf
protocols = imap pop3
auth_mechanisms = plain
passdb {
   driver = sql
   args = /etc/dovecot/dovecot-sql.conf
}
userdb {
   driver = sql
   args = /etc/dovecot/dovecot-sql.conf
}

service auth {
   unix_listener /var/spool/postfix/private/auth {
       group = postfix
       mode = 0660
       user = postfix
   }
   user = root
}
#service auth {
# inet_listener {
#   port = 587
# }
#}
mail_home = /home/vmail/%d/%n
mail_location = maildir:~

ssl_cert = </etc/letsencrypt/live/eumela.ga/fullchain.pem
ssl_key = </etc/letsencrypt/live/eumela.ga/privkey.pem

10-auth.conf、10-mail.conf、10-master.conf、10-ssl.conf 和 20-imap.conf 的輸出(來自 /etc/dovecot/conf.d)


更新是今天 8 月 24 日的日誌。它是 mail.log、mail.err 和 mail.info 的組合

感謝@Stefan的回答,但我也必須這樣做:

$ sudo postconf -e 'mydestination = localhost.$mydomain, localhost, $mydomain'

現在我可以收到來自外面的郵件了…

PS:我可以在“mydestination”中指定“all”嗎?

inet_interfaces = localhost # I've tried using my IP address, with no luck`

如果您只在 localhost 上收聽,您的 smtp 伺服器將無法從外部訪問。您可能應該將其更改為all。參看。 http://www.postfix.org/postconf.5.html#inet_interfaces

重新啟動後綴服務後,您可以檢查netstat -tulpn伺服器正在偵聽的介面和埠。

如果 postfix 正在偵聽埠 25 上的所有介面但仍無法從外部訪問,則應檢查防火牆設置

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