我试图将CentOS 8主机上的根邮件重定向到外部邮件external@externaldomain.tld,因此当cron作业失败时我会收到电子邮件通知。
接收邮件服务器位于Uberspace.de上。我在发送CentOS 8主机上设置了一个自己在后缀中拥有的域;
/etc/后缀/main.f
mydomain = mydomain.org
myorigin = $mydomain否则(例如FROM域没有MX记录时),在uberspace上发送到收件人邮件服务器的所有邮件都将被
said: 550 No MX for your FROM address (in reply to MAIL FROM command)用echo test | mail -s "test" external@externaldomain.tld测试邮件是可行的。
我尝试通过/root/..forward转发
externaluser@externalmail.comecho test | mail -s "test" root,但现在邮件被发送到root@mydomain.org
我试着通过/etc/别名转发
root: externaluser@externalmail.comsudo newaliases && echo test | mail -s "test" root,但现在邮件被发送到root@mydomain.org
有没有人知道我怎样才能把所有的邮件发送给externaluser@externalmail.com呢?
发布于 2021-01-03 11:56:33
嗨,我也在努力解决这个问题,我遵循了大量的教程,最终得到了有效的解决方案,但是很难确定到底是哪一部分的教程。
无论如何,要让echo test | mail -s test root自动发送到myaddress@gmail.com地址,就像echo test | mail -s test myaddress@gmail.com在我的Raspberry上所做的那样:
我编辑/etc/postfix/main.cf的方式如下:
myhostname = zero.lan
smtpd_banner = $myhostname ESMTP $mail_name (Raspbian)
biff = no
append_dot_mydomain = yes
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 127.0.0.0/8
inet_interfaces = loopback-only
recipient_delimiter = +
relay_domains =
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls = yes
compatibility_level = 2然后编辑/etc/aliases如下:
postmaster: root
root: localuser
localuser: myaddress@gmail.com并运行sudo newaliases和sudo systemctl reload postfix,这为我做了诀窍。
https://unix.stackexchange.com/questions/611657
复制相似问题