我在UNIX中通过sendmail发送带有HTML和附件的邮件。 但是我无法以这种方式添加多个附件,我的目标是发送带有html内容和附件的邮件 - 但是无法在这里添加多个附件。
mail_msg2()
{
DIR="/home/input"
SENDING_FILE_NAME="ExportData.xls"
v_mailpart="$(uuidgen)/$(hostname)"
echo "From: hello@world.com
To: hello@world.com
Cc: hello@world.com
Subject: $SubjectData
Content-Type: multipart/mixed; boundary=\"$v_mailpart\"
MIME-Version: 1.0
This is a multi-part message in MIME format.
--$v_mailpart
Content-Type: text/html
$Body
--$v_mailpart
Content-Transfer-Encoding: base64
Content-Type: application/xlsx; name=$SENDING_FILE_NAME
Content-Disposition: attachment; filename=$SENDING_FILE_NAME
`base64 $DIR/$SENDING_FILE_NAME`
--$v_mailpart--" | /usr/sbin/sendmail -t
}
身体= cat $path/output/output.html
答案 0 :(得分:0)
这一位:
--$v_mailpart
Content-Transfer-Encoding: base64
Content-Type: application/xlsx; name=$SENDING_FILE_NAME
Content-Disposition: attachment; filename=$SENDING_FILE_NAME
`base64 $DIR/$SENDING_FILE_NAME`
每个附件都需要重复。