简单的邮件服务器测试

1、安装postfix

yum  -y install postfix

可能会报错提示依赖so文件,百度下载相关的so文件即可
2、修改配置文件,配置相关的邮件服务器信息(最后新加4行)

vi  /etc/mail.rc
set from=[email protected]             # 发件人邮箱 ,qq邮箱或者其他邮箱
set smtp=smtp.qq.com                # smtp地址不变 ,这是qq邮箱的第三方发送邮件的地址
set smtp-auth-user=[email protected]   #发件人邮箱与set [email protected]保持一致               
set smtp-auth-password=snbskgiwjzlajg        #snbskgiwjzlajg为qq邮箱开启的授权码而非密码

3、测试发送邮件

echo 666666 | mailx -s "测试" 11****@qq.com

4、正常收到邮件
5、如果启动postfix报以下错误解决办法

centos7 postfix 出现: Active: failed (Result: exit-code)
centos7 postfix 出现: Active: failed (Result: exit-code) | KouKou

systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2017-04-21 21:32:59 CST; 5s ago
  Process: 8785 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
  Process: 8783 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 8780 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=75)
 
Apr 21 21:32:57 iZd2ibnn6ajh9jZ systemd[1]: Starting Postfix Mail Transport Agent...
Apr 21 21:32:57 iZd2ibnn6ajh9jZ aliasesdb[8780]: /usr/sbin/postconf: fatal: parameter inet_interfaces: no local interface found for ::1
Apr 21 21:32:58 iZd2ibnn6ajh9jZ aliasesdb[8780]: newaliases: fatal: parameter inet_interfaces: no local interface found for ::1
Apr 21 21:32:58 iZd2ibnn6ajh9jZ postfix[8785]: fatal: parameter inet_interfaces: no local interface found for ::1
Apr 21 21:32:59 iZd2ibnn6ajh9jZ systemd[1]: postfix.service: control process exited, code=exited status=1
Apr 21 21:32:59 iZd2ibnn6ajh9jZ systemd[1]: Failed to start Postfix Mail Transport Agent.
Apr 21 21:32:59 iZd2ibnn6ajh9jZ systemd[1]: Unit postfix.service entered failed state.
Apr 21 21:32:59 iZd2ibnn6ajh9jZ systemd[1]: postfix.service failed.

解决方法:
修改 /etc/postfix/main.cf的设置
inet_protocols = ipv4
inet_interfaces = all

你可能感兴趣的:(服务器)