linux主机定时发送邮件(s-nail)
·
在linux主机通过定时任务指定在每天12:12分定时发送邮件;邮件内容自定。
1.进行挂载并确认配置文件
- [root@localhost ~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@localhost ~]# cat /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
2.下载并配置 s-nail
[root@localhost ~]#dnf install s-nail -y
[root@localhost ~]# vim /etc/s-nail.rc
进入配置文件,在最下方添加配置
set from=xxxxxxxxxx@163.com(邮箱地址)
set smtp=smtp.163.com
set smtp-auth-user=xxxxxxxxxx@163.com(邮箱地址)
set smtp-auth-password=授权码
set smtp-auth=login
3.添加周期性任务
- [root@localhost ~]# crontab -e
#分 时 日 月 周
12 12 * * * echo 在linux主机通过定时任务指定在每天12:12分定时发送邮件 | mail -s "定时发送邮件" xxxxxxxxxx@163.com
4.查看结果
#分 时 日 月 周
0 9 * * * echo | mail -s "定时发送邮件" xxxxxxxxxx@163.com

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)