mail如何在linux中发送邮件,使用163邮箱发信。 如何在linux中发送邮件,使用163邮箱发信。

如何在linux中发送邮件,使用163邮箱发信。

 

linux中,可以使用mail命令往外发送邮件,在使用前,只需要指定如下简单配置即可,这里演示用  163.com    邮箱发送至 qq.com

编辑 /etc/mail.rc,写入下方的参数

set from=18211146***@163.com     发送邮件的邮箱
 
set smtp=smtp.163.com            邮箱域名,使用163邮箱发信,要填写smtp.163.com,而不是mail.163.com。

set smtp-auth-user=18211146***@163.com   #邮箱账号
 
set smtp-auth-password=twgdhbtzhy***       #邮箱登录密码,或者,授权码,使用163邮箱需要设置授权码,这里定义的是授权码,图1-1

set smtp-auth=login
复制代码
[root@Centos7 ~]# tail -10 /etc/mail.rc

set from=18211146***@163.com

set smtp=smtp.163.com

set smtp-auth-user=18211146***@163.com

set smtp-auth-password=twgdhbtzhy***

set smtp-auth=login
复制代码

图1-1

 设置完毕后就可以发件测试了。

邮件标题:Hello World

邮件内容:你好 小戴

收件方:1274378***@qq.com

[root@Centos7 ~]# echo "你好,小戴" |mail -s 'Hello World' 1274378***@qq.com

结果查看。

linux中,可以使用mail命令往外发送邮件,在使用前,只需要指定如下简单配置即可,这里演示用  163.com    邮箱发送至 qq.com

编辑 /etc/mail.rc,写入下方的参数

set from=18211146***@163.com     发送邮件的邮箱
 
set smtp=smtp.163.com            邮箱域名,使用163邮箱发信,要填写smtp.163.com,而不是mail.163.com。

set smtp-auth-user=18211146***@163.com   #邮箱账号
 
set smtp-auth-password=twgdhbtzhy***       #邮箱登录密码,或者,授权码,使用163邮箱需要设置授权码,这里定义的是授权码,图1-1

set smtp-auth=login
复制代码
[root@Centos7 ~]# tail -10 /etc/mail.rc

set from=18211146***@163.com

set smtp=smtp.163.com

set smtp-auth-user=18211146***@163.com

set smtp-auth-password=twgdhbtzhy***

set smtp-auth=login
复制代码

图1-1

 设置完毕后就可以发件测试了。

邮件标题:Hello World

邮件内容:你好 小戴

收件方:1274378***@qq.com

[root@Centos7 ~]# echo "你好,小戴" |mail -s 'Hello World' 1274378***@qq.com

结果查看。

猜你喜欢

转载自www.cnblogs.com/zhangmingda/p/12303856.html