postfix 配置外部smtp邮箱发送邮件记录

安装环境.

Linux VM-0-13-debian 3.16.0-10-686-pae #1 SMP Debian 3.16.76-1 (2019-11-12) i686 GNU/Linux

1.安装

apt-get install bsd-mailx postfix -y

2.编辑修改 /etc/postfix/main.cf

#mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mydestination = root, localhost, localhost.localdomain, localhost
relayhost = smtp.189.cn:25
inet_interfaces = loopback-only

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_mechanism_filter =
sender_canonical_maps = regexp:/etc/postfix/sender_canonical

3.编辑修改/etc/postfix/sasl_passwd

vi /etc/postfix/sasl_passwd
smtp.189.cn:25 xxx@xxxx:pass
:w
:! sudo postmap /etc/postfix/sasl_passwd
:wq

4.编辑修改 /etc/postfix/sender_canonical

vi /etc/postfix/sender_canonical
/.+/ xxx@xxxx
:w
:! sudo postmap /etc/postfix/sender_canonical
:wq

5.测试

echo "你好啊,这是一封测试!"  |  mail  -s 'text' 邮箱地址

end…

你可能感兴趣的:(Linux)