我已经在 ubuntu 上设置了一个邮件服务器。
我检查了端口是否打开,并仔细检查了所有配置文件,检查了我能找到的每个谷歌搜索结果。大多数类似的帖子都有更复杂的日志和我已经采取的概述步骤。
我可以毫无问题地从我的服务器发送电子邮件,但我无法接收它们。
以下是尝试从我的大学电子邮箱和我的 Gmail 电子邮箱发送电子邮件后的邮件日志:
Jan 3 19:02:03 li740-32 postfix/smtpd[19816]: connect from mail-by2on0070.outbound.protection.outlook.com[207.46.100.70]
Jan 3 19:02:04 li740-32 postfix/smtpd[19816]: NOQUEUE: reject: RCPT from mail-by2on0070.outbound.protection.outlook.com[207.46.100.70]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<na01-by2-obe.outbound.protection.outlook.com>
Jan 3 19:02:04 li740-32 postfix/smtpd[19816]: disconnect from mail-by2on0070.outbound.protection.outlook.com[207.46.100.70]
Jan 3 19:02:32 li740-32 postfix/smtpd[19816]: connect from mail-vc0-f178.google.com[209.85.220.178]
Jan 3 19:02:33 li740-32 postfix/smtpd[19816]: NOQUEUE: reject: RCPT from mail-vc0-f178.google.com[209.85.220.178]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-vc0-f178.google.com>
Jan 3 19:02:33 li740-32 postfix/smtpd[19823]: connect from mail-vc0-f172.google.com[209.85.220.172]
Jan 3 19:02:34 li740-32 postfix/smtpd[19816]: disconnect from mail-vc0-f178.google.com[209.85.220.178]
Jan 3 19:02:34 li740-32 postfix/smtpd[19823]: NOQUEUE: reject: RCPT from mail-vc0-f172.google.com[209.85.220.172]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-vc0-f172.google.com>
Jan 3 19:02:35 li740-32 postfix/smtpd[19823]: disconnect from mail-vc0-f172.google.com[209.85.220.172]
当我向自己发送电子邮件时记录:
Jan 3 20:31:41 li740-32 postfix/smtpd[20703]: connect from CPE-121-208-28-184.bxny1.woo.bigpond.net.au[121.208.28.184]
Jan 3 20:31:43 li740-32 postfix/smtpd[20703]: 0AB1FE675: client=CPE-121-208-28-184.bxny1.woo.bigpond.net.au[121.208.28.184], sasl_method=LOGIN, [email protected]
Jan 3 20:31:43 li740-32 postfix/cleanup[20715]: 0AB1FE675: message-id=<[email protected]>
Jan 3 20:31:43 li740-32 postfix/qmgr[20683]: 0AB1FE675: from=<[email protected]>, size=2731, nrcpt=1 (queue active)
Jan 3 20:31:45 li740-32 dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=121.208.28.184, lip=106.185.34.32, mpid=20718, TLS, session=<9uuNWMULlQB50By4>
Jan 3 20:31:46 li740-32 postfix/smtpd[20703]: disconnect from CPE-121-208-28-184.bxny1.woo.bigpond.net.au[121.208.28.184]
Jan 3 20:31:50 li740-32 postfix/smtp[20716]: 0AB1FE675: to=<[email protected]>, relay=none, delay=7.5, delays=0.67/0.01/6.8/0, dsn=5.4.6, status=bounced (mail for vapsterthekoala.com loops back to myself)
Jan 3 20:31:50 li740-32 postfix/cleanup[20715]: 5D12FE677: message-id=<20150103203150.5D12FE677@makaveli>
Jan 3 20:31:50 li740-32 postfix/qmgr[20683]: 5D12FE677: from=<>, size=4510, nrcpt=1 (queue active)
Jan 3 20:31:50 li740-32 postfix/bounce[20719]: 0AB1FE675: sender non-delivery notification: 5D12FE677
Jan 3 20:31:50 li740-32 postfix/qmgr[20683]: 0AB1FE675: removed
Jan 3 20:31:50 li740-32 postfix/smtp[20716]: 5D12FE677: to=<[email protected]>, relay=none, delay=0, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for vapsterthekoala.com loops back to myself)
Jan 3 20:31:50 li740-32 postfix/qmgr[20683]: 5D12FE677: removed
Jan 3 20:32:21 li740-32 dovecot: imap([email protected]): Disconnected: Logged out in=2989 out=1780
Jan 3 20:32:23 li740-32 dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=121.208.28.184, lip=106.185.34.32, mpid=20722, TLS, session=<fCbHWsULnwB50By4>
Jan 3 20:32:43 li740-32 dovecot: imap([email protected]): Connection closed in=498 out=4241
主文件:
#See /usr/share/postfix/main.cf.dist for a commented, more complete version
# 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
# 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_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_cert_file=/etc/dovecot/dovecot.pem
smtpd_tls_key_file=/etc/dovecot/private/dovecot.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
#Enabling SMTP for authenticated users, and handing off authentication to Dovecot
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
#smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = makaveli
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = vapsterthekoala.com, makaveli, localhost.localdomain, localhost
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
#Handing off local delivery to Dovecot's LMTP, and telling it where to store mail
virtual_transport = lmtp:unix:private/dovecot-lmtp
答案1
您的mydestination
域名不包含您自己的域名,因此 Postfix 不知道它应该在本地投递邮件。这就是为什么您会看到“中继访问被拒绝”和“邮件回环到我自己”等错误。
看起来您已经设置了它,但是已将其注释掉。
#mydestination = vapsterthekoala.com, makaveli, localhost.localdomain, localhost
mydestination = localhost
只需添加您的域名mydestination
并重新加载 Postfix。
答案2
我不知道我做错了什么,但重新设置后问题就解决了。对感兴趣的人而言,这是一份指南。https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and-mysql#postfix