我尝试在 CentOS 7 VPS 上为我的域设置 Postfix 2.10/Dovecot 2.2 电子邮件服务器,但我遇到了对手,必须依靠互联网。我正在使用 Nginx 和 MariaDB 与 PostfixAdmin,并将使用 Roundcube 进行网络邮件(但首先要做的是)。Postfix 使用虚拟邮箱,存储在 中/var/www/mail/vmail
。
我必须承认,在寻求帮助的过程中,我访问了数十个网站,并且我的配置文件可能已经退化为现在在某些地方变得毫无意义的内容;提前道歉。
status deferred
当我尝试使用 发送邮件时出现错误。如果需要,我可以发布其他日志。sudo echo Subject: sendmail test" | sendmail -v [email protected]
/etc/dovecot/conf.d/
/var/log/maillog
:
Sep 22 14:04:08 hwsrv-579344 postfix/pickup[15245]: 20D8146379C: uid=1000 from=<contos_user>
Sep 22 14:04:08 hwsrv-579344 postfix/cleanup[20958]: 20D8146379C: message-id=<[email protected]>
Sep 22 14:04:08 hwsrv-579344 postfix/qmgr[15246]: 20D8146379C: from=<[email protected]>, size=288, nrcpt=1 (queue active)
Sep 22 14:04:08 hwsrv-579344 postfix/smtp[20967]: Untrusted TLS connection established to mx-aol.mail.gm0.yahoodns.net[67.195.204.80]:25: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Sep 22 14:04:08 hwsrv-579344 postfix/smtp[20967]: 20D8146379C: to=<[email protected]>, relay=mx-aol.mail.gm0.yahoodns.net[67.195.204.80]:25, delay=3.4, delays=2.7/0.02/0.42/0.21, dsn=5.7.5, status=bounced (host mx-aol.mail.gm0.yahoodns.net[67.195.204.80] said: 556 5.7.5 Invalid RFC missing body (in reply to end of DATA command))
Sep 22 14:04:08 hwsrv-579344 postfix/cleanup[20958]: D124A4637A2: message-id=<[email protected]>
Sep 22 14:04:08 hwsrv-579344 postfix/qmgr[15246]: D124A4637A2: from=<>, size=2259, nrcpt=1 (queue active)
Sep 22 14:04:08 hwsrv-579344 postfix/bounce[20969]: 20D8146379C: sender non-delivery notification: D124A4637A2
Sep 22 14:04:08 hwsrv-579344 postfix/cleanup[20958]: D443F463820: message-id=<[email protected]>
Sep 22 14:04:08 hwsrv-579344 postfix/bounce[20970]: 20D8146379C: sender delivery status notification: D443F463820
Sep 22 14:04:08 hwsrv-579344 postfix/qmgr[15246]: 20D8146379C: removed
Sep 22 14:04:08 hwsrv-579344 postfix/qmgr[15246]: D443F463820: from=<>, size=2080, nrcpt=1 (queue active)
Sep 22 14:04:08 hwsrv-579344 dovecot: lmtp(20972): Connect from local
Sep 22 14:04:08 hwsrv-579344 dovecot: lmtp(20976): Connect from local
Sep 22 14:04:08 hwsrv-579344 dovecot: auth: Fatal: sql /etc/dovecot/conf.d/dovecot-sql.conf.ext: Can't open configuration file /etc/dovecot/conf.d/dovecot-sql.conf.ext: No such file or directory
Sep 22 14:04:08 hwsrv-579344 dovecot: master: Error: service(auth): command startup failed, throttling for 32 secs
Sep 22 14:04:08 hwsrv-579344 dovecot: lmtp([email protected]): Error: userdb lookup([email protected]): Disconnected unexpectedly
Sep 22 14:04:08 hwsrv-579344 dovecot: lmtp([email protected]): Error: userdb lookup([email protected]): Disconnected unexpectedly
Sep 22 14:04:08 hwsrv-579344 postfix/lmtp[20971]: D124A4637A2: to=<[email protected]>, relay=mail.example.com[private/dovecot-lmtp], delay=0.08, delays=0.01/0.01/0.01/0.04, dsn=4.3.0, status=deferred (host mail.example.com[private/dovecot-lmtp] said: 451 4.3.0 <[email protected]> Internal error occurred. Refer to server log for more information. (in reply to RCPT TO command))
Sep 22 14:04:08 hwsrv-579344 dovecot: lmtp(20972): Disconnect from local: Successful quit
Sep 22 14:04:08 hwsrv-579344 postfix/lmtp[20973]: D443F463820: to=<[email protected]>, relay=mail.example.com[private/dovecot-lmtp], delay=0.07, delays=0.01/0.01/0.01/0.04, dsn=4.3.0, status=deferred (host mail.example.com[private/dovecot-lmtp] said: 451 4.3.0 <[email protected]> Internal error occurred. Refer to server log for more information. (in reply to RCPT TO command))
Sep 22 14:04:08 hwsrv-579344 dovecot: lmtp(20976): Disconnect from local: Successful quit
/etc/dovecot/dovecot.conf
:
!include conf.d/*.conf
!include_try /usr/share/dovecot/protocols.d/*.protocol
!include conf.d/auth-sql.conf.ext
protocols = "imap pop3 lmtp"
login_greeting = My Mail Server
auth_mechanisms = plain login
namespace inbox {
type = private
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 =
}
mail_home = /var/www/mail/vmail/%d/%n
mail_location = maildir:~
ssl = yes
ssl_cert = </etc/ssl/private/vmail.crt
ssl_key = </etc/ssl/private/vmail.key
/etc/dovecot/dovecot-mysql.conf
:
driver = mysql
connect = host=localhost dbname=postfix_db user=dovecot password=tr=&He4toSw!crUBi$iq
default_pass_scheme = SHA512-CRYPT
user_query = SELECT '/var/www/mail/vmail/%d/%u' as home, 'maildir:/var/vmail/%d/%u' as mail, 2000 AS uid, 8 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
password_query = SELECT username as user, password, '/var/www/mail/vmail/%d/%n' as userdb_home, 'maildir:/var/vmail/%d/%n' as userdb_mail, 2000 as userdb_uid, 8 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
/etc/dovecot/conf.d/10-master.conf
service imap-login {
inet_listener imap {
#port = 143
}
inet_listener imaps {
#port = 993
#ssl = yes
}
}
service pop3-login {
inet_listener pop3 {
#port = 110
}
inet_listener pop3s {
port = 995
ssl = yes
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
inet_listener lmtp {
# Avoid making LMTP visible for the entire internet
address = 127.0.0.1
port = 2424
}
}
service imap {
process_limit = 1024
}
service pop3 {
process_limit = 1024
}
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
group = vmail
}
user = dovecot
}
service auth-worker {
#user = root
}
service dict {
user = vmail
}
/etc/postfix/main.cf
mail_owner = postfix
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost, localhost.$mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP $mail_name (CentOS)
biff = no
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
append_dot_mydomain = no
broken_sasl_auth_clients = yes
mailbox_size_limit = 0
smtp_tls_security_level = may
smtp_tls_loglevel = 1
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks,
permit_sasl_authenticated,
defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_path = /run/dovecot/auth-client
smtpd_sasl_security_options = noanonymous,
noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_CAfile = /etc/ssl/private/fullchain.pem
smtpd_tls_cert_file = /etc/ssl/private/fullchain.pem
smtpd_tls_key_file = /etc/ssl/private/vmail.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/www/mail/vmail
virtual_mailbox_domains = mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 512000000
virtual_mailbox_maps = mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_minimum_uid = 2000
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_uid_maps = static:2000
local_transport = virtual
transport_maps = hash:/etc/postfix/transport
在此先感谢对此问题的任何阐释。