由于谷歌云不允许从虚拟机发送电子邮件,端口 25 被阻止,我正在使用第三方服务 Mailjet 与虚拟机发送电子邮件,我正在使用 docker 容器安装 postfix 并测试 Mailjet 的工作。
- 使用以下命令成功配置 Postfix 中继谷歌文档
- 能够使用 发送电子邮件,邮件由 Mailjet 接收。
echo 'Test passed.' | mail -s Test-Email [email protected]
问题
*发送测试邮件时, 邮件将发送至echo 'Test passed.' | mail -s Test-Email [email protected]
邮件喷射
问题是它使用[电子邮件保护]
,Mailjet 要求我确认,我配置了[电子邮件保护]Mailjet 也想要同样的[电子邮件保护]代替[电子邮件保护],尝试了很多解决方案都没有用,
附加配置和日志
/var/log/mail.log
May 14 17:57:38 mydomain postfix/qmgr[1446]: 891A3199F: removed
May 14 18:04:51 mydomain postfix[2587]: Postfix is running with backwards-compatible default settings
May 14 18:04:51 mydomain postfix[2587]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:51 mydomain postfix[2587]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:51 mydomain postfix/postfix-script[2593]: fatal: the Postfix mail system is already running
May 14 18:04:58 mydomain postfix[2709]: Postfix is running with backwards-compatible default settings
May 14 18:04:58 mydomain postfix[2709]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:58 mydomain postfix[2709]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:58 mydomain postfix/postfix-script[2715]: fatal: the Postfix mail system is already running
May 14 18:05:17 mydomain postfix[2831]: Postfix is running with backwards-compatible default settings
May 14 18:05:17 mydomain postfix[2831]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:05:17 mydomain postfix[2831]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:05:17 mydomain postfix/postfix-script[2837]: fatal: the Postfix mail system is already running
May 14 18:05:30 mydomain postfix/pickup[1445]: 4506C2086: uid=0 from=<[email protected]>
May 14 18:05:30 mydomain postfix/cleanup[2845]: 4506C2086: message-id=<[email protected]>
May 14 18:05:30 mydomain postfix/qmgr[1446]: 4506C2086: from=<[email protected]>, size=352, nrcpt=1 (queue active)
May 14 18:05:30 mydomain postfix/smtp[2847]: warning: database /etc/postfix/generic.db is older than source file /etc/postfix/generic
May 14 18:05:31 mydomain postfix/smtp[2847]: 4506C2086: to=<[email protected]>, relay=in.mailjet.com[104.xxx.xx.xx]:2525, delay=1.7, delays=0.02/0.01/1.3/0.33, dsn=2.0.0, status=sent (250 OK queued as 64ced0eb-ab23-498b-be32-2c267c128ce4)
May 14 18:05:31 mydomain postfix/qmgr[1446]: 4506C2086: removed
grep postfix /var/log/syslog
May 14 17:57:38 mydomain postfix/qmgr[1446]: 891A3199F: removed
May 14 18:04:51 mydomain postfix[2587]: Postfix is running with backwards-compatible default settings
May 14 18:04:51 mydomain postfix[2587]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:51 mydomain postfix[2587]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:51 mydomain postfix/postfix-script[2593]: fatal: the Postfix mail system is already running
May 14 18:04:58 mydomain postfix[2709]: Postfix is running with backwards-compatible default settings
May 14 18:04:58 mydomain postfix[2709]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:04:58 mydomain postfix[2709]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:04:58 mydomain postfix/postfix-script[2715]: fatal: the Postfix mail system is already running
May 14 18:05:17 mydomain postfix[2831]: Postfix is running with backwards-compatible default settings
May 14 18:05:17 mydomain postfix[2831]: See http://www.postfix.org/COMPATIBILITY_README.html for details
May 14 18:05:17 mydomain postfix[2831]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
May 14 18:05:17 mydomain postfix/postfix-script[2837]: fatal: the Postfix mail system is already running
May 14 18:05:30 mydomain postfix/pickup[1445]: 4506C2086: uid=0 from=<[email protected]>
May 14 18:05:30 mydomain postfix/cleanup[2845]: 4506C2086: message-id=<[email protected]>
May 14 18:05:30 mydomain postfix/qmgr[1446]: 4506C2086: from=<[email protected]>, size=352, nrcpt=1 (queue active)
May 14 18:05:30 mydomain postfix/smtp[2847]: warning: database /etc/postfix/generic.db is older than source file /etc/postfix/generic
May 14 18:05:31 mydomain postfix/smtp[2847]: 4506C2086: to=<[email protected]>, relay=in.mailjet.com[104.199.96.85]:2525, delay=1.7, delays=0.02/0.01/1.3/0.33, dsn=2.0.0, status=sent (250 OK queued as 64ced0eb-ab23-498b-be32-2c267c128ce4)
May 14 18:05:31 mydomain postfix/qmgr[1446]: 4506C2086: removed
猫/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
virtual_alias_maps = hash:/etc/postfix/virtual
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
# 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 = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, mydomain.com, localhost.com, localhost
relayhost = in.mailjet.com:2525
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
#default_transport = error
#relay_transport = error
inet_protocols = all
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_generic_maps = hash:/etc/postfix/generic
猫/等/别名
# See man 5 aliases for format
postmaster: root
root: [email protected]
cat /etc/邮件名称
mydomain.com
我对 Postfix 配置还不熟悉,尝试了很多解决方案后仍找不到解决方案,感谢您的帮助。