Config Postfix as a Send-Only SMTP Server on Ubuntu 18.04
每次新装服务器都忘了怎么安装这个mail sender的服务,记一下。
1,安装postfix
1 | $ apt update |
上面这一步在安装postfix的时候会提示Postfix Configuration选项:
1,General type of mail configuration 选 Internet site
2,System mail name 里写域名就好
然后选择OK,安装完毕。
2,修改postfix config file
1 | $ vim /etc/postfix/main.cf |
修改以下两行:
1 | inet_interfaces = loopback-only |
保存后退出,重启postfix:
1 | $ systemctl restart postfix |
3,测试
1 | $ echo "Send-Only Server" | mail -s "Mail Testing" to@yourmail.com |