Centos

postfix和dovecot收不到郵件

  • September 7, 2017

我在 VPS 上設置了一個郵件伺服器(帶有多個虛擬主機)。我使用過 postfix、dovecot、postfixadmin、squirrel 和 mysql。我可以用松鼠發郵件,但收不到任何郵件。這是我的 /var/log/maillog

Apr 21 16:52:49 vultr postfix/qmgr[8072]: 90BB738C61: from=<mymail@gmail.com>, size=19715, nrcpt=1 (queue active)
Apr 21 16:52:49 vultr postfix/qmgr[8072]: warning: connect to transport private/dovecot: Connection refused
Apr 21 16:52:49 vultr postfix/error[8213]: 90BB738C61: to=<info@mysite.ca>, relay=none, delay=0.13, delays=0.13/0/0/0, dsn=4.3.0, status=deferred (mail transport unavailable)

這是postconf -n輸出:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
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 = all
inet_protocols = all
mail_owner = postfix
mailbox_command = /usr/libexec/dovecot/deliver
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = localhost
myhostname = mail.onlineprintshop.ca
mynetworks = 127.0.0.0/8 [::1]/128
myorigin = onlineprintshop.ca
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_mynetworks,permit_tls_all_clientcerts,reject_unauth_destination,permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = cyrus
smtpd_tls_ask_ccert = yes
smtpd_tls_cert_file = /etc/keys/pub.crt
smtpd_tls_key_file = /etc/keys/prv.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = no
smtpd_tls_req_ccert = yes
smtpd_tls_security_level = none
smtpd_tls_session_cache_database = btree:/var/spool/postfix/smtpd_tls_session_cache
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:8
virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 150
virtual_transport = dovecot
virtual_uid_maps = static:150
postconf: warning: /etc/postfix/main.cf: unused parameter: dovecot_destination_recipient_limit=1

這是dovecot -n輸出:

(Core)  ext3
first_valid_uid = 150
mail_location = maildir:/var/mail/%d/%n
mbox_write_locks = fcntl
namespace inbox {
 inbox = yes
 location =
 mailbox Drafts {
   special_use = \Drafts
 }
 mailbox Junk {
   special_use = \Junk
 }
 mailbox Sent {
   special_use = \Sent
 }
 mailbox "Sent Messages" {
   special_use = \Sent
 }
 mailbox Trash {
   special_use = \Trash
 }
 prefix =
}
passdb {
 args = /etc/dovecot/dovecot-sql.conf.ext
 driver = sql
}
protocols = imap pop3
ssl = required
ssl_cert = /etc/pki/dovecot/certs/dovecot.pem
ssl_key = /etc/pki/dovecot/private/dovecot.pem
userdb {
 driver = passwd
}
userdb {
 args = /etc/dovecot/dovecot-sql.conf.ext
 driver = sql
}

這是postconf -M輸出:

smtp       inet  n       -       n       -       -       smtpd
smtps      inet  n       -       -       -       -       smtpd -o 
syslog_name=postfix/smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject
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
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

任何的想法?

問題是這條線:

Apr 21 16:52:49 vultr postfix/qmgr[8072]: warning: connect to transport private/dovecot: Connection refused

“連接被拒絕”表示沒有程序監聽該套接字,這可能是 /var/spool/postfix/private/dovecot 。由於您的postconf -M輸出沒有列出任何關於dovecot您在 master.cf 中缺少一行的資訊,例如:

dovecot unix - n n - - pipe
 flags=DRhu argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}

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