利用postfix&mailx搭建邮件服务器
程序员文章站
2022-07-10 10:40:34
...
1、安装postfix和mailx组件
apk add postfix
apk add mailx
2、按照以下内容修改/etc/postfix/main.cfg,如果参数前面有#注释,请去掉
myhostname = mail.test.com
mydomain = test.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
3、重启postfix
alpine:~# /etc/init.d/postfix start * Caching service dependencies ... [ ok ] * Starting postfix ...
alpine:~# /etc/init.d/postfix status * status: started [ ok ]
4、测试邮件是否正常发送
echo "test postfix" | mail -s "title" aaa@qq.com
注:xxx.163.com为自己邮箱地址
5、登录自己邮箱,查看是否收到邮件
6、关闭服务
alpine:~# /etc/init.d/postfix stop * Stopping postfix ... [ ok ]
alpine:~# /etc/init.d/postfix status * status: stopped
7、测试ok