电子邮件不存储。Postfix、Dovecot 和 MySQL

电子邮件不存储。Postfix、Dovecot 和 MySQL

我正在尝试使用 Postfix 和 Dovecot 设置邮件服务器,使用 MySQL 来存储别名、域和用户。

问题是用户没有收到电子邮件。

根据日志文件,收到的邮件被保存了,但结果是没有存储。

但无论如何都会发生一些事情,因为创建了一个文件夹 /mail,其中有一个 .imap,其中有另一个文件夹 /INBOX,其中包含以下文件:

  • dovecot.index.cache
  • dovecot.index.log
Log: Oct 18 19:59:22 vmd119784 postfix/qmgr[1939]: 43475800A6C: from=<[email protected]>, size=351, nrcpt=1 (queue active)

Oct 18 19:59:22 vmd119784 dovecot: lmtp(2126): Connect from local

Oct 18 19:59:22 vmd119784 postfix/lmtp[2125]: 43475800A6C: to=<[email protected]>, relay=mail.mydomain.art[private/dovecot-lmtp], delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> 8BOlEPocMGVOCAAAulSNBQ Saved)

Oct 18 19:59:22 vmd119784 dovecot: lmtp([email protected])<2126><8BOlEPocMGVOCAAAulSNBQ>: msgid=<[email protected]>: saved mail to INBOX

Oct 18 19:59:22 vmd119784 dovecot: lmtp(2126): Disconnect from local: Client has quit the connection (state=READY)

Oct 18 19:59:22 vmd119784 postfix/qmgr[1939]: 43475800A6C: removed

我将邮件位置放在“/var/mail/vhosts/mydomain.art”。

我编辑过的配置文件:

/etc/postfix/main.cf/

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

append_dot_mydomain = no
readme_directory = no

compatibility_level = 2

smtpd_tls_cert_file=/etc/letsencrypt/live/mydomain.art/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mydomain.art/privkey.pem

smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

smtpd_helo_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_invalid_helo_hostname,
        reject_non_fqdn_helo_hostname
smtpd_recipient_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_non_fqdn_recipient,
        reject_unknown_recipient_domain,
        reject_unlisted_recipient,
        reject_unauth_destination
smtpd_sender_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_non_fqdn_sender,
        reject_unknown_sender_domain
smtpd_relay_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        defer_unauth_destination


myhostname = mail.mydomain.art
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

mydomain = mydomain.art
myorigin = $mydomain

mydestination = localhost
relayhost = 

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

mailbox_size_limit = 0
recipient_delimiter = +

inet_interfaces = all
inet_protocols = all

virtual_transport = lmtp:unix:private/dovecot-lmtp

virtual_mailbox_domains = mysql:/etc/postfix/sql/virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/sql/virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/sql/virtual-alias-maps.cf, mysql:/etc/postfix/sql/virtual-email2email.cf

disable_vrfy_command = yes
strict_rfc821_envelopes = yes

#smtpd_etrn_restrictions = reject
#smtpd_reject_unlisted_sender = yes
#smtpd_reject_unlisted_recipient = yes

smtpd_delay_reject = yes
smtpd_helo_required = yes
smtp_always_send_ehlo = yes

smtpd_timeout = 30s
smtp_helo_timeout = 15s
smtp_rcpt_timeout = 15s
smtpd_recipient_limit = 40
minimal_backoff_time = 180s
maximal_backoff_time = 3h

invalid_hostname_reject_code = 550
non_fqdn_reject_code = 550
unknown_address_reject_code = 550
unknown_client_reject_code = 550
unknown_hostname_reject_code = 550
unverified_recipient_reject_code = 550
unverified_sender_reject_code = 550

/etc/dovecot/dovecot.conf

!include_try /usr/share/dovecot/protocols.d/*.protocol

protocols = imap pop3 lmtp
postmaster_address = postmaster at mydomain.art

mail_location = maildir:/var/mail/vhosts/%d/%n/
mail_privileged_group = mail

!include conf.d/*.conf
!include_try local.conf

/etc/dovecot/conf.d/10-mail.conf/

mail_location = mbox:~/mail:INBOX=/var/mail/%u

namespace inbox {
    inbox = yes
}

mail_privileged_group = mail

protocol !indexer-worker { 

}

日志中没有任何错误或警告可能表明 vmail 用户无权访问或找不到路径,所以我有点沮丧。

我尝试在本地交换邮件,发送本身也可以。此外,还可以发送到外部的我的 gmail 地址。

除此之外,我再次检查了我的配置,但不幸的是找不到任何能让我解决问题的东西。

相关内容