Chinaunix首页 | 论坛 | 博客
  • 博客访问: 648113
  • 博文数量: 139
  • 博客积分: 2655
  • 博客等级: 少校
  • 技术积分: 1723
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-02 16:03
文章分类

全部博文(139)

文章存档

2013年(2)

2011年(17)

2010年(14)

2009年(86)

2008年(20)

分类:

2009-04-10 20:06:52

    前段时间搞系统监控,当机器出现问题时需要通过邮件报警通知,用专门的邮件服务器Sendmail or Postfix有点"杀鸡用牛刀"的感觉,无意中在找到一个命令行的工具sendEmail(乍看和Sendmail很像,注意多了一个E,perl写的).用起来挺好,而且支持多平台.最新版是2006年的v1.55(其实用Python也可自己实现的,就像前面的发送天气预报一样)

1.About 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]

其实最长用的是 ./sendEmail -f from@gmail.com -t to@sina.com -cc cc@sohu.com -u "Test" -m "Nothing, just test it" (-o message-file=yourfile) -a attachmentfile -s smtp.gmail.com -xu yourname -xp youguessit  (-o tls)

2.还发现个问题:
(1).我若以gmail的smtp发送没问题,而且收发信很快
(2).以sohu的smtp发送,偶尔会出现类似下面的信息:
Apr 10 19:52:23 localhost sendEmail[22019]: ERROR => Received:     451 4.2.1 CONTENT REJECT:sohu engine content reject gx2008758@sohu.com:
     重新发送就没问题了,很怪异的事
(3).若是以sina的smtp发送,99%会出现(有一次成功过,不过是延迟了1个小时后收到的,后来再也没成功发送过):
Apr 10 19:56:11 localhost sendEmail[22285]: ERROR => Received:     500 #5.5.1 command not recognized
我一开始是用sina的账户给我自己的gmail发信,一直出现这个错误,开始怀疑这个程序有问题,后来换gmail的可以,换sohu的也可以.不晓得怎么会是这样?

   3. 其网站上说可以发送anonymous邮件,但是我用gmail的账户测试了下 -f 选项from@sohu.com,From栏内为"from@sohu.com"其实算不上匿名的
   4. 对于Encrypted Email,按照网站上的例子实验下,可以发送,并以附件形式发送签名的信息,但是二进制的,大致能看出我的signed_message的信息。关键对openssl生成的私钥,证书,还有.pem不是很熟,有空好好研究下。
文件:sendEmail-v1.55.tar.gz
大小:26KB
下载:下载


 Reference:


http://blog.csdn.net/leftatrium/archive/2006/04/11/658732.aspx

http://blog.csdn.net/gisfarmer/archive/2009/02/27/3943460.aspx
%E7%8E%8B%E5%B0%8F%E4%BA%91%E6%95%99%E6%8E%88%E7%A9%B6%E7%AB%9F%E6%98%AF%E5%A6%82%E4%BD%95%E9%9C%87%E6%92%BC%E5%AF%86%E7%A0%81%E5%AD%A6%E7%95%8C%E7%9A%84/


阅读(3707) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~