##邮件发送流程分析
![](https://box.kancloud.cn/8cfce6a01d02da744f5f1082f446fb4f_1333x583.png)
##telnet模拟邮件发送过程
###**1)安装talnet服务**
参考[centos7安装telnet服务](http://www.cnblogs.com/lixuwu/p/6102444.html)
```
// 1. 检查是否已经安装telnet-server、xinetd
rpm -qa telnet-server
rpm -qa xinetd
// 2. 如果上面没反应则没有安装,先安装telnet
yum list |grep telnet
// 3. 安装telent
yum install telnet-server.x86_64
yum install telnet.x86_64
// 4. 安装xinetd
yum list |grep xinetd
yum install xinetd.x86_64
// 5. 安装完成后,将xinetd和telnet服务加入开机自启动:
systemctl enable xinetd.service
systemctl enable telnet.socket
// 6. 最后,启动以上两个服务即可
systemctl start telnet.socket
systemctl start xinetd
(或service xinetd start)
```
附上各个服务器的端口,这里我试过用qq企业版邮箱发送,并且是根据邮箱里的客户端设置进行发送,但是一直失败;后面重新注册了个阿里云邮箱才成功发送
```
Office 365
POP setting
Server name: pod51003.outlook.com
Port: 995
Encryption method: SSL
IMAP setting
Server name: pod51003.outlook.com
Port: 993
Encryption method: SSL
SMTP setting
Server name: pod51003.outlook.com
Port: 587
Encryption method: TLS
____________________________________________________
阿里云
*使用前需在账号里开通客户端密码
POP3
pop3.aliyun.com
端口:110
端口(SSL):995
IMAP
imap.aliyun.com
端口:143
端口(SSL):993
SMTP
smtp.aliyun.com
端口:25
端口(SSL):465
____________________________________________________
QQ
POP
pop.qq.com
端口:110
端口(SSL):995
SMTP
smtp.qq.com
端口:25
端口(SSL):465/587
```
###**2)在windows下发送邮件**
···
// 连接阿里云邮箱
telnet smtp.aliyun.com 25
helo hi
250 OK
auth login
334 dXNlcm5hbWU6
USERbase64加密后的用户名
334 UGFzc3dvcmQ6
PASSbase64加密后的密码
235 Authentication successful
MAILFROM:XXX@.COM
250 Mail OK
RCPTTO:XXX@COM
250 Mail OK
DATA
354 End data with .
from: aliyun
to: sina
subject: this is a demo show
this is email content
.
250 Data Ok:queued as freedom
···