---
title: "linux设置mail邮件服务器"
author: "andyniu"
date: "2016-05-11T14:37:09Z"
tags: []
categories: ["操作系统"]
slug: "linux-mail"
draft: false
lastmod: "2016-05-11T14:37:09Z"
id: 2297456
url: "https://andyniu.iteye.com/blog/2297456"
---

**在linux下设置SMTP服务器并用mail命令发邮件精解步骤：**

1.vi /etc/mail.rc

set [from=aaa@xxx.cn](mailto:from=aaa@xxx.cn)    #默认对外发送邮件的用户邮箱地址  
set smtp=aa.smtp.xx.cn    #选用默认发送邮件的公共邮件域名  
set [smtp-auth-user=aaa@xxx.cn](mailto:smtp-auth-user=hls-bbss-xq@chinaunicom.cn)    #默认对外发邮件的用户  
set smtp-auth-password=123456    #对应默认用户的密码  
set smtp-auth=login        #默认使用login

 

2.vi /etc/hosts  添加邮箱地址对应的ip

10.0.0.123   aaa@xxx.cn

 

3.测试邮件发送

echo “"邮箱测试test" | mail -s "邮箱测试test"  [11111111@qq.com](mailto:11111111@qq.com)

可以正常接收邮件！