mail命令發送html格式的電子郵件

如果沒有mail命令,使用yum安裝:

#yum install -y mailx  

要發送html格式郵件,關鍵是在郵件頭部指定內容格式,如下:


$mail -s "$(echo -e "subject\nContent-Type: text/html; charset=utf-8")"  [email protected] < mail.htm  

這裏最巧妙的是使用了echo -e,使得subject輸入了一個回車,就可以在頭部定義Content-Type了
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章