![Postfix 在服务重新启动之前不会发送邮件](https://linux22.com/image/70128/Postfix%20%E5%9C%A8%E6%9C%8D%E5%8A%A1%E9%87%8D%E6%96%B0%E5%90%AF%E5%8A%A8%E4%B9%8B%E5%89%8D%E4%B8%8D%E4%BC%9A%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6.png)
当我重启服务器时,postfix 会启动 - 我可以通过执行 来验证这一点postfix status
。它显示“Postfix 邮件系统已启动并正在运行”。但是,当我尝试从 PHP 脚本发送电子邮件时,它并没有被发送,而只是停留在邮件队列中。我可以通过输入 来验证这一点mailq
,它显示了应该发送的消息。如果我重启后缀,而不是服务器,通过运行postfix stop
then postfix start
,电子邮件将在 30 秒到一分钟内送达。为什么我必须重新启动 postfix 才能使其正常工作?
这是我的 /etc/postfix/main.cf 文件,其中所有注释都被删除。
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = myhostname.mydomain.com #I actually have my real domain on my server entered here
mydomain = mydomain.com.com #I have the real domain on my server
myorigin = $myhostname
inet_interfaces = $myhostname
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
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
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix/samples
readme_directory = /usr/share/doc/postfix/README_FILES
对于命令postconf -n
:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
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
html_directory = no
inet_interfaces = $myhostname
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = domain.com # real domain replaced for anonymity
myhostname = host.domain.com #real was taken out
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
sample_directory = /usr/share/doc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550