Site icon Mr. 沙先生

在Command Line下發送附件(Attachment)信

方法還滿多的,以下為我比較喜歡使用的方法,若不符合您的需求,可以參考我提供的參考文獻連結,該文還提供許多方式。

$ATTFile = “/tmp/binary_file”
$TXTFile = “/tmp/txt_file”
$SUBJECT=”Attachment test”
$MAILTO=”beakdoosan@gmail.com”

  1. SHELL> uuencode $ATTFile $ATTFile | mail -s “$SUBJECT” $MAILT
    #uuencode 在CentOS要另外安裝,標準的Repo並沒有這個套件
  2. SHELL> mutt -a $ATTFile -s $SUBJECT $MAILTO < $TXTFile
    #mutt是大多數的Linux都會有的MUA


參考文獻:
Sending email with attachments on UNIX systems

轉貼至http://beakdoosan.blogspot.tw/

Exit mobile version