天天看點

指令行及腳本發送郵件測試的方法

指令行及腳本發送郵件測試的方法:

方法一:

[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:<[email protected]> 

250 2.1.0 <[email protected]>... Sender ok 

data 

354 Enter mail, end with "." on a line by itself 

----------------------------------

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 <[email protected]> 

TO:[email protected]

Cc:[email protected] 

Bcc:[email protected] 

subject:mail testing 

EOF

    本文轉自vcdog 51CTO部落格,原文連結:http://blog.51cto.com/255361/836915,如需轉載請自行聯系原作者