Postfix

無法通過 Postfix/Dovecot 的電子郵件客戶端發送電子郵件

  • June 1, 2018

在我的帶有 Postfix、Dovecot 和 Postgresql 的伺服器上,我可以錯誤地接收電子郵件,但不能發送它們。通過雷鳥。

嘗試發送時,我在 Postfix 的日誌中看到了這一點:

 postfix/qmgr[14391]: B63131F952: from=<>, size=2376, nrcpt=1 (queue active)
 postfix/smtp[15967]: connect to fdsafds.com[11.22.33.44]:25: Connection timed out
 postfix/smtp[15967]: B63131F952: to=<fdsafds@fdsafds.com>, relay=none, delay=412770, delays=412739/0.03/30/0, dsn=4.4.1, status=deferred (connect to fdsafds.com[11.22.33.44]:25: Connection timed out)
 postfix/submission/smtpd[15973]: connect from unknown[33.44.55.66]
 postfix/submission/smtpd[15973]: warning: connect #1 to subsystem public/submission-header-cleanup: No such file or directory
 postfix/submission/smtpd[15973]: warning: connect #2 to subsystem public/submission-header-cleanup: No such file or directory
 postfix/submission/smtpd[15973]: warning: connect #10 to subsystem public/submission-header-cleanup: No such file or directory
 postfix/submission/smtpd[15973]: fatal: connect #11 to subsystem public/submission-header-cleanup: No such file or directory
 postfix/master[14389]: warning: process /usr/lib/postfix/bin/smtpd pid 15973 exit status 1
 postfix/master[14389]: warning: /usr/lib/postfix/bin/smtpd: bad command startup -- throttling
 postfix/anvil[15975]: statistics: max connection rate 1/60s for (submission:33.44.55.66) at Jun  1 03:34:19
 postfix/anvil[15975]: statistics: max connection count 1 for (submission:33.44.55.66) at Jun  1 03:34:19
 postfix/anvil[15975]: statistics: max cache size 1 at Jun  1 03:34:19

可能是什麼原因?

 $ sudo postconf -M
 smtp       inet  n       -       n       -       -       smtpd
 pickup     unix  n       -       n       60      1       pickup
 cleanup    unix  n       -       n       -       0       cleanup
 qmgr       unix  n       -       n       300     1       qmgr
 tlsmgr     unix  -       -       n       1000?   1       tlsmgr
 rewrite    unix  -       -       n       -       -       trivial-rewrite
 bounce     unix  -       -       n       -       0       bounce
 defer      unix  -       -       n       -       0       bounce
 trace      unix  -       -       n       -       0       bounce
 verify     unix  -       -       n       -       1       verify
 flush      unix  n       -       n       1000?   0       flush
 proxymap   unix  -       -       n       -       -       proxymap
 proxywrite unix  -       -       n       -       1       proxymap
 smtp       unix  -       -       n       -       -       smtp
 relay      unix  -       -       n       -       -       smtp -o syslog_name=postfix/$service_name
 showq      unix  n       -       n       -       -       showq
 error      unix  -       -       n       -       -       error
 retry      unix  -       -       n       -       -       error
 discard    unix  -       -       n       -       -       discard
 local      unix  -       n       n       -       -       local
 virtual    unix  -       n       n       -       -       virtual
 lmtp       unix  -       -       n       -       -       lmtp
 anvil      unix  -       -       n       -       1       anvil
 scache     unix  -       -       n       -       1       scache
 smtp       inet  n       -       n       -       -       smtpd -o smtpd_sasl_auth_enable=no
 submission inet  n       -       y       -       -       smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_sasl_type=dovecot -o smtpd_sasl_path=private/auth -o smtpd_sasl_security_options=noanonymous -o milter_macro_daemon_name=ORIGINATING -o smtpd_helo_required=no -o smtpd_helo_restrictions= -o cleanup_service_name=submission-header-cleanup

   $ sudo postconf -n 
   alias_database =
   alias_maps =
   allow_percent_hack = no
   biff = no
   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
   disable_vrfy_command = yes
   home_mailbox = Maildir/
   html_directory = no
   inet_interfaces = all
   inet_protocols = ipv4
   mail_owner = postfix
   mail_spool_directory = /var/mail/local
   mailbox_size_limit = 0
   mailq_path = /usr/bin/mailq
   manpage_directory = /usr/share/man
   message_size_limit = 51200000
   meta_directory = /etc/postfix
   mydestination = $mydomain, localhost.$mydomain, localhost
   mydomain = my_domain123.com
   myhostname = mail.my_domain123.com
   mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
   myorigin = $mydomain
   newaliases_path = /usr/bin/newaliases
   queue_directory = /var/spool/postfix
   readme_directory = /usr/share/doc/postfix
   recipient_delimiter = +
   sample_directory = /etc/postfix
   sendmail_path = /usr/bin/sendmail
   setgid_group = postdrop
   shlib_directory = /usr/lib/postfix
   show_user_unknown_table_name = no
   smtp_dns_support_level = dnssec
   smtp_tls_security_level = dane
   smtp_tls_session_cache_database = btree:${data_directory}/smtp_tlscache
   smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_reverse_client_hostname, reject_unauth_pipelining
   smtpd_data_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_multi_recipient_bounce, reject_unauth_pipelining
   smtpd_helo_required = yes
   smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_unauth_pipelining
   smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_pipelining
   smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination
   smtpd_sasl_auth_enable = yes
   smtpd_sasl_path = private/auth
   smtpd_sasl_security_options = noanonymous, noplaintext
   smtpd_sasl_tls_security_options = noanonymous
   smtpd_sasl_type = dovecot
   smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining
   smtpd_tls_auth_only = yes
   smtpd_tls_cert_file = /etc/letsencrypt/live/mail.my_domain123.com/fullchain.pem
   smtpd_tls_dh1024_param_file = /etc/ssl/dh2048.pem
   smtpd_tls_dh512_param_file = /etc/ssl/dh512.pem
   smtpd_tls_key_file = /etc/letsencrypt/live/mail.my_domain123.com/privkey.pem
   smtpd_tls_mandatory_ciphers = high
   smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1, TLSv1.2
   smtpd_tls_received_header = yes
   smtpd_tls_security_level = may
   smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_tlscache
   strict_rfc821_envelopes = yes
   swap_bangpath = no
   tls_high_cipherlist = ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
   tls_ssl_options = no_ticket, no_compression
   unknown_local_recipient_reject_code = 550
   virtual_alias_domains =
   virtual_mailbox_domains = pgsql:/etc/postfix/virtual_mailbox_domains.cf
   virtual_mailbox_maps = pgsql:/etc/postfix/virtual_mailbox_maps.cf
   virtual_transport = lmtp:unix:private/dovecot-lmtp

請注意,為了接收電子郵件,我必須在 Thunderbird 的設置中使用 SSL/TLS,而在使用 SSL/TLS 時發送它不會連接。當我嘗試發送電子郵件並使用 STARTTLS 時,它至少會連接。

您正在使用 呼叫您的送出服務cleanup_service_name=submission-header-cleanup。但是,您沒有submission-header-cleanup配置任何名為的服務。

-o cleanup_service_name=submission-header-cleanup從您的中刪除master.cf(預設cleanup_servicecleanup並且如果您刪除此覆蓋將生效)或配置submission-header-cleanup服務。

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