代码改变世界

Linux主从同步监测和利用sendMail来发邮件

  youxin  阅读(964)  评论(0编辑  收藏  举报

首先介绍下sendMail

About SendEmail
SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to learn and use.
[Supported Platforms: Linux, BSD, OS X, Windows 98, Windows NT, Windows 2000, & Windows XP]

http://caspian.dotconf.net/menu/Software/SendEmail/

下载解压后就能使用命令行工具了。或者:

安装方法:
1) Extract the package
    tar -zxvf sendEmail-v1.XX.tar.gz

2) Copy the sendEmail script to /usr/local/bin
    cp -a sendEmail-v1.XX/sendEmail /usr/local/bin

3) Make sure its executable
    chmod +x /usr/local/bin/sendEmail

4) Run it
    sendEmail
      or
    /usr/local/bin/sendEmail

 

部分参数如下:
-f 表示from,发件人地址
-t 表示to,收件人地址
-s mail服务器域名
-u 主题
-xu 用户名(@之前的)
-xp 用户密码
-m 纯文本信息
-o message-file=/root/.. 发送文件中的内容
-a 发送附件 (-m,-o,-a可以同时使用)
例如:
[root@blog sendEmail-v1.56]# ./sendEmail -f aaaa@163.com -t bbbb@163.com -s smtp.163.com -xu aaaa -xp password -u test -m testeamil
Apr 10 10:09:16 blog sendEmail[8861]: Email was sent successfully!
问题:
1·如果出现如下提示
Jan 30 10:06:15 ora01 sendEmail[8704]: ERROR => Connection attempt to localhost:25 failed: IO::Socket::INET: connect: Connection refused
是没有指定-s参数,邮件服务器域名。

 

 

shell脚本监测:

http://blog.chinaunix.net/uid-7589639-id-3018209.html

 

大多数邮件服务都有短信通知服务,比如sina的就有每个月50条免费短信用,对于个人来说,够用了。

 

编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
历史上的今天:
2012-12-16 硬盘接口:SCSI、IDE与SATA的区别
2012-12-16 cpu插槽 LGA 1155
2011-12-16 table表格
点击右上角即可分享
微信分享提示