|
1. 用uuencode轉換你的附件
uuencode attachment_name your_attachment_new_name
比如:
你有一個文件叫“test.txt”, 但你想讓這個文件在加到郵件的附件后,在對方的MUA中附件顯示的名字是“sailor.log”
uuencode test.txt sailor.log >a.tmp
這時你打開"a.tmp",開頭會有一行begin 644 sailor.log,說明這個文件會以sailor.log的文件名向大家展示
2. 添加郵件正文
打開剛剛save的“a.tmp",在開頭加加上你想要寫的正文,即郵件的body部分。比如"a.tmp"的內(nèi)容如下:
begin 644 sailor.log
-:&5L;&\@=V]R;&0A"@`` ` end 在begin的前面加入你的正文,如
this is a message
begin 644 sailor.log -:&5L;&\@=V]R;&0A"@`` ` end 3. 發(fā)送郵件
mail -s "this is mail subject" zhan@websense.com<a.tmp
好了,現(xiàn)在這封郵件發(fā)出去了。
它發(fā)給了”zhan@websense.com".
郵件的正文是你字上一步加入的“this is a message”
郵件的附件名是你自定義的“sailor.log"
郵件的附件的內(nèi)容是你以前的文件”text.txt"
郵件的subject是“this is mail subject"
另:mail的一點常識
1. 如果在發(fā)送時加上參數(shù)-v,會看到服務器的相應哦
2. 如果想改變sender的地址可以加上“-- -f <new_sender_address>”,如:
mail -v -s "sadooof" zhan@websense.com<a -- -f aa@linux.com 3. Centos下安裝 uuencode 命令如下: # yum install sharutils
|
|
|