我对后缀很陌生。当我连接到我的LXD容器时,有些容器有“/var/ mail /root中的新邮件”。由于没有参考这些收件箱,我想将它们重新路由到Exchange (O365 one)上的另一个收件箱。
我成功地使用以下参数配置了其他应用程序:
['smtp_enable'] = true
['smtp_address'] = "mail.external-smtp-exchange.com"
['smtp_port'] = 587
['smtp_user_name'] = "noreply@subdomain.contoso.com"
['smtp_password'] = ""
['smtp_domain'] = "subdomain.contoso.com"
['smtp_authentication'] = "login"
['smtp_enable_starttls_auto'] = true
['smtp_tls'] = false
我希望所有的用户在发送邮件时使用一个“noreply”地址(FROM)。因此,以这种方式修改了/etc/aliases
:
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: noreply@subdomain.contoso.com
然后是newaliases
,以重新加载所有内容。
main.cf
文件内容
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = 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 = core-keycloak.internal-domain.com
myorigin = /etc/mailname
mydestination = $myhostname, subdomain.contoso.com, core-keycloak, localhost.localdomain, localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
relayhost = [mail.external-smtp-exchange.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp.sasl
smtp_sasl_security_options = noanonymous
smtp_use_tls = no
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_interfaces = all
inet_protocols = all
### Tried also parameters below without any improvement
smtp_generic_maps = regexp:/etc/postfix/smtp_generic_maps
sender_canonical_classes = envelope_sender, header_sender
sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
smtp_header_checks = regexp:/etc/postfix/smtp_header_checks
如果不使用最后4个参数覆盖FROM电子邮件,我将得到以下输出:
Jun 8 13:23:21 core-keycloak postfix/smtp[18264]: 86C822CE8A: to=, relay=mail.external-smtp-exchange.com[]:587, delay=2995, delays=2989/0.01/5.3/0, dsn=4.7.3, status=deferred (SASL authentication failed; server mail.external-smtp-exchange.com[] said: 535 5.7.3 Authentication unsuccessful)
Jun 8 13:23:23 core-keycloak postfix/pickup[18261]: 413752CEAA: uid=0 from=
Jun 8 13:23:23 core-keycloak postfix/cleanup[18271]: 413752CEAA: message-id=<20220608112323.413752CEAA@core-keycloak.winternal-domain.com>
Jun 8 13:23:23 core-keycloak postfix/qmgr[18262]: 413752CEAA: from=, size=408, nrcpt=1 (queue active)
使用最后4个参数覆盖FROM电子邮件,我得到以下输出:
Jun 8 13:25:23 core-keycloak postfix/pickup[18334]: 68B772CEB0: uid=0 from=
Jun 8 13:25:23 core-keycloak postfix/cleanup[18346]: 68B772CEB0: message-id=<20220608112523.68B772CEB0@core-keycloak.internal-domain.com>
Jun 8 13:25:23 core-keycloak postfix/qmgr[18335]: 68B772CEB0: from=, size=408, nrcpt=1 (queue active)
在这两种情况下,我都不会在Exchange收件箱中收到任何消息。
任何帮助都是受欢迎的。
<#>编辑
我在密码中有一些特殊的字符,比如!([])
等等.
发布于 2022-06-08 19:26:40
由于您的中继没有指定原因,"SASL身份验证失败“可以处理不同的事情。
smtp_use_tls
中是一个废弃的速记,用于启用机会主义传输安全性,在其他软件中,这个名称指的是禁用(在此上下文中已过时) STARTTLS机制,而不是立即设置传输安全性。删除**smtp_use_tls
** from您的 main.cf
**,而使用**smtp_tls_security_level = encrypt
**。*后一种配置独立于正在使用的机制应用策略,影响到所有传出的SMTP,即端口465上的TLS (通过后缀称为tls_wrappermode )和端口587上的STARTTLS。请记住,您的地址映射配置可能不会对以前的测试产生任何影响,因为默认情况下,Postfix附带了一些配置,以防止对已知的主机进行过多的重试,不接受凭据和/或邮件,因此在以后的尝试中缺少一个postfix/smtp
日志行。检查队列(postqueue -p
)中潜在的未完成消息。
https://serverfault.com/questions/1102794
复制