我是一个 Linux 新手,非常感谢您提供的任何帮助和耐心。
我正在运行 Ubuntu 21.04
我正在尝试设置通过 postfix 发送的邮件。
这是我的配置:
nano /etc/postfix/main.cf
# 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
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = <mydomain>.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, mail.<mydomain>.com, <computer name>, localhost.localdomain, localhost
relayhost = [mail.<mydomain>.com]:465
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
# Enable SASL authentication
smtp_sasl_auth_enable = yes
# Disallow methods that allow anonymous authentication
smtp_sasl_security_options = noanonymous
# Location of sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_tls_wrappermode = yes
smtp_tls_security_level = encrypt
我通过运行以下命令发送测试电子邮件:
echo "Test Mail" | mail -s "Test Email" <[email protected]>
但是,我从未收到过电子邮件(我检查过我的垃圾邮件文件夹)。
以下是
nano /var/log/mail.log
Aug 22 01:01:13 <computername> postfix/pickup[1396540]: 1F77980FA1: uid=1000 from=<<user>@<computername>>
Aug 22 01:01:13 <computername> postfix/cleanup[1396964]: 1F77980FA1: message-id=<20210822050113.1F77980FA1@<mydomain>.com
Aug 22 01:01:13 <computername> postfix/qmgr[1396541]: 1F77980FA1: from=<user>@<computername>, size=347, nrcpt=1 (queue active)
Aug 22 01:01:13 <computername> postfix/smtp[1396966]: warning: database /etc/postfix/sasl_passwd.db is older than source file /etc/postfix/sasl_passwd
Aug 22 01:01:14 <computername> postfix/smtp[1396966]: 1F77980FA1: to=<[email protected]>, relay=mail.<mydomain>.com[<ip address>]:465, delay=1.2, delays=0.07/0.08/0.74/0.27, dsn=2.0.0, status=sent (250 OK id=1mHfbe-001L4X-3a)
Aug 22 01:01:14 <computername> postfix/qmgr[1396541]: 1F77980FA1: removed
在此先感谢您提供的任何帮助。
答案1
是的,这个配置是正确的。