命令行及脚本发送邮件测试的方法:
方法一:
[root@dg01 ~]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 dg01.com.cn ESMTP Sendmail 8.13.8/8.13.8; Fri, 19 Aug 2011 06:53:38 -0400
helo demo.domain.tld
250 dg01.com.cn Hello localhost.localdomain [127.0.0.1], pleased to meet you
mail from:<kevin@dg01.com.cn>
250 2.1.0 <kevin@dg01.com.cn>... Sender ok
rcpt to:<kevin@hotmail.com>
250 2.1.5 <kevin@hotmail.com>... Recipient ok
data
354 Enter mail, end with "." on a line by itself
----------------------------------
This is the mail test content
----------------------------------
----------------------------------
This is the mail test content
----------------------------------
.
250 2.0.0 p7JArcEE018377 Message accepted for delivery
quit
方法二:
脚本测试
[root@dg01 ~]# cat mtest.sh
#!/bin/bash
/usr/sbin/sendmail -t <<EOF
From: Mail testing <kevin@gmail.com>
TO:kevin@126.com
Cc:root@dg01.com.cn
Bcc:kevin@hotmail.com
subject:mail testing
----------------------------------
This is the mail test content
----------------------------------
----------------------------------
This is the mail test content
----------------------------------
EOF
本文转自vcdog 51CTO博客,原文链接:http://blog.51cto.com/255361/836915,如需转载请自行联系原作者