Postfix

SMTP(後綴)和 iPhone - 無法發送電子郵件 - 拒絕:RCPT

  • February 19, 2020

我已經嘗試設置電子郵件伺服器 2 天,當我在 PC 上使用 roundcube 時一切正常,我可以發送和接收電子郵件,但是當我想在 iPhone 上設置我的電子郵件時問題開始了。我可以接收電子郵件,但不能發送任何電子郵件。

Dec 25 15:44:16 servername postfix/smtpd[17833]: Anonymous TLS connection established from unknown[120.218.*.*]: TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)
Dec 25 15:44:16 servername postfix/smtpd[17833]: NOQUEUE: reject: RCPT from unknown[120.218.*.*]: 454 4.7.1 <recipientMail@gmail.com>: Relay access denied; from=<myEmail> to=<recipientMail@gmail.com> proto=ESMTP helo=<[192.168.1.104]>
Dec 25 15:44:17 kaka90 postfix/smtpd[17833]: disconnect from unknown[120.218.*.*]

我在帶有 SSL/TLS、postfix+debian 的 ubuntu 上執行它。Postfix 沒有身份驗證。這是我的 main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no

readme_directory = no

smtpd_tls_cert_file = /etc/ssl/domain/2_domain.crt
smtpd_tls_key_file =  /etc/ssl/startssl/myserver.key
smtpd_tls_CAfile = /etc/ssl/domain/1_root_bundle.crt
smtpd_use_tls=yes
smtp_use_tls=yes
smtpd_tls_auth_only = no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_mandatory_ciphers = high
tls_high_cipherlist=EDH+CAMELLIA(****)
smtpd_tls_loglevel = 1
smtp_tls_loglevel = 1
smtpd_tls_received_header = yes
broken_sasl_auth_clients = yes
smtpd_delay_reject = yes

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain =
smtpd_sasl_security_options=noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_destination, permit_mynetworks check_relay_domains

myhostname = domain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = domain
mydestination = domain, localhost.domain, localhost
relayhost =
mynetworks = 127.0.0.0/8 192.168.0.0/16 [::ffff:127.0.0.0]/104 [::1]/128
#mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

您可能在伺服器上使用 Roundcube,預設情況下 localhost 被授權發送郵件。您的 iPhone 來自外部 IP,並且隨著時間的推移它可能會定期更改 IP,因此您不能簡單地授權該 IP 發送郵件。您需要使用登錄名/密碼對 postfix 進行身份驗證,才能被授權發送郵件,就像您向 dovecot 進行身份驗證以被授權閱讀您的郵件一樣。

Postfix 似乎已經設置為允許這樣做(smtpd_recipient_restrictions = permit_sasl_authenticated),但是您是否將 iPhone 配置為在發送郵件時使用相同的登錄名/密碼進行連接,因為它用於閱讀郵件?如果您還沒有這樣做,您可能還想告訴它連接到送出埠 (587) 而不是 smtp 埠 (25)。

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