我通過使用以下命令發送電子郵件,方法是將所有輸出和發送到一個電子郵件中。這對我來說可以。使用shell腳本在電子郵件中附加一個html文件
mailx -s "LIP Data Quality Report for $DATE_YEST_FORMAT1" -r [email protected] [email protected] <<EOF
Data Successfully loaded into LIP_DATA_QUALITY table
Total Items Purchased: `echo $QUERY1 | awk '{print $1}'`
Total Items MissingorMismatch: `echo $QUERY1 | awk '{print $2}'`
Error Percentage: $QUERY2
EOF
現在我需要附上上述電子郵件中的一個文件,該文件是temp folder
下與chart
名稱。發送時我需要將它作爲chart.html
文件發送。
那麼如何修改我的上述命令,以便它可以在電子郵件中附加chart
作爲chart.html file
來自temp folder
。
希望我明白給大家。我正在運行SunOS
。
任何建議,將不勝感激。
更新: -
如果我需要在我的shell腳本添加的uuencode命令所以它應該是像下面?還是其他什麼東西
mailx -s "LIP Data Quality Report for $DATE_YEST_FORMAT1" -r [email protected] [email protected] <<EOF
uuencode /tmp/chart chart.html
Data Successfully loaded into LIP_DATA_QUALITY table
Total Items Purchased: `echo $QUERY1 | awk '{print $1}'`
Total Items MissingorMismatch: `echo $QUERY1 | awk '{print $2}'`
Error Percentage: $QUERY2
EOF
[如何使用HP-UX shell腳本將簡單文本文件發送爲附件?](http://stackoverflow.com/questions/6274325/how-to-send-simple-text-file-as- attachment-using-hp-ux-shell-script) – 2012-08-13 05:50:47
使用Python或Perl編寫MIME消息比使用shell腳本更容易。 – 2012-08-13 09:12:18