在 systemctl 重新启动 postfix 之前,Postfix 不会发送电子邮件

在 systemctl 重新启动 postfix 之前,Postfix 不会发送电子邮件

我一直在尝试在 Ubuntu 18.04 上设置 smtp postfix。我终于得到了它,以便 gmail 收件人看到 SPF 和 DKIM 通过(尽管它仍然最终出现在垃圾邮件文件夹中,不知道为什么?)

但是,在发送电子邮件时,大多数情况下,直到我使用 重新启动该过程后才会发送电子邮件sudo systemctl restart postfix

当我这样做时systemctl status postfix,它会说active (exited)

我不确定这是为什么,有什么想法吗?我希望电子邮件能够立即发送,而不必像这样重新启动它。

如果我应该提供任何其他信息/文件,请告诉我:

/etc/postfix/main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more compl$


# 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

# See http://www.postfix.org/COMPATIBILITY_README.html -- default$
# fresh installs.
compatibility_level = 2

# 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_$
smtp_tls_session_cache_database = btree:${data_directory}/smtp_sc$

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc pac$
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenti$
myhostname = [removed].com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost.learn$
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all


# Milter configuration
milter_default_action = accept
milter_protocol = 6
smtpd_milters = local:opendkim/opendkim.sock
non_smtpd_milters = $smtpd_milters

会议后-n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = loopback-only
inet_protocols = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
milter_default_action = accept
milter_protocol = 6
mydestination = $myhostname, localhost.$mydomain, localhost.[removed].com, [removed].com, [removed].local, localhost.local, localhost
myhostname = [removed].com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
non_smtpd_milters = $smtpd_milters
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_milters = local:opendkim/opendkim.sock
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

/var/log/mail.log

Apr 28 10:18:25 [removed] postfix/postfix-script[1679]: starting the Postfix mail system
Apr 28 10:18:25 [removed] postfix/master[1681]: daemon started -- version 3.3.0, configuration /etc/postfix
Apr 28 10:18:25 [removed] postfix/pickup[1682]: E88CD81E22: uid=0 from=<no-reply@[removed].com>
Apr 28 10:18:25 [removed] opendkim[1456]: OpenDKIM Filter: mi_stop=1
Apr 28 10:18:25 [removed] opendkim[1456]: OpenDKIM Filter v2.11.0 terminating with status 0, errno = 0
Apr 28 10:18:25 [removed] postfix/cleanup[1685]: warning: milter local:opendkim/opendkim.sock: can't read SMFIC_OPTNEG reply packet header: Connection reset by peer
Apr 28 10:18:25 [removed] postfix/cleanup[1685]: warning: milter local:opendkim/opendkim.sock: read error in initial handshake
Apr 28 10:18:25 [removed] postfix/cleanup[1685]: E88CD81E22: message-id=<222b02b2-6a3c-3e6f-5083-b9889f5be672@[removed].com>
Apr 28 10:18:25 [removed] postfix/qmgr[1683]: E88CD81E22: from=<no-reply@[removed].com>, size=1357, nrcpt=1 (queue active)
Apr 28 10:18:25 [removed] opendkim[1692]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)
Apr 28 10:18:28 [removed] postfix/smtp[1690]: E88CD81E22: to=<[removed]@gmail.com>, relay=gmail-smtp-in.l.google.com[2404:6800:4003:c06::1b]:25, delay=545, delays=542/0.01/1.4/1.5, dsn=2.0.0, stat$
Apr 28 10:18:28 [removed] postfix/qmgr[1683]: E88CD81E22: removed
Apr 28 10:19:13 [removed] postfix/pickup[1682]: A30DB81E22: uid=0 from=<no-reply@[removed].com>
Apr 28 10:19:13 [removed] postfix/cleanup[1685]: A30DB81E22: message-id=<2e5c7f36-b481-4815-e666-3f057951f498@[removed].com>
Apr 28 10:19:13 [removed] opendkim[1692]: KeyTable entry for 'default._domainkey.[removed].com' corrupt
Apr 28 10:19:13 [removed] opendkim[1692]: A30DB81E22: error loading key 'default._domainkey.[removed].com'
Apr 28 10:19:13 [removed] postfix/cleanup[1685]: A30DB81E22: milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.7.1 Service unavailable - try again later; from=<no-reply@[removed]$
Apr 28 10:19:25 [removed] postfix/pickup[1682]: A71D981E22: uid=0 from=<no-reply@[removed].com>
Apr 28 10:19:25 [removed] postfix/cleanup[1685]: A71D981E22: message-id=<2e5c7f36-b481-4815-e666-3f057951f498@[removed].com>
Apr 28 10:19:25 [removed] opendkim[1692]: KeyTable entry for 'default._domainkey.[removed].com' corrupt
Apr 28 10:19:25 [removed] opendkim[1692]: A71D981E22: error loading key 'default._domainkey.[removed].com'
Apr 28 10:19:25 [removed] postfix/cleanup[1685]: A71D981E22: milter-reject: END-OF-MESSAGE from localhost[127.0.0.1]: 4.7.1 Service unavailable - try again later; from=<no-reply@[removed]$

答案1

感谢大家的评论,终于找到了这指示我注释掉以下中的某些行/etc/opendkim.conf

KeyFile /etc/opendkim/keys/mail.private
#KeyTable /etc/opendkim/KeyTable
#SigningTable /etc/opendkim/SigningTable

然后我使用 PTR 记录设置 rDNS。现在,电子邮件会立即发送,无需重新启动,并且我在邮件测试器上获得了完美的 10/10 分数

相关内容