Linux下通过mail命令发送邮件

树叶云

Linux下可以通过使用mail命令,利用外部的一个邮箱(比如xxx.163.com)发送邮件到另外一个邮箱(比如yyy.qq.com),这在某些情况下很有用,比如监测系统温度,当温度达到一定时就报警,向邮箱发送报警信息,提示管理员网络异常等。

image-20211130120943510

找到配置文件/etc/mail.rc添加如下行

# vi /etc/mail.rc  set [email protected]set smtp=smtp.qq.com  
set smtp-auth-user=123456
set smtp-auth-password=sbsbsbsb
set smtp-auth=login

通过以下命令发送邮件

echo  hello word | mail -s " title" [email protected] [email protected]

多个邮件地址使用空格分开

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/219617.html<

(0)
运维的头像运维
上一篇2025-04-14 04:54
下一篇 2025-04-14 04:55

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注