我正在尝试使用以下shell发送电子邮件。但是,此命令一次在电子邮件正文中发送内容而不是附件。请建议在一封邮件中将电子邮件正文和附件一起发送的正确语法或逻辑。
smtpserver="0.0.0.0"
sender="email_id"
subject="subject"
MSG="message"
ReportFile="<PATH>/attachment.csv"
CLASSPATH="<classpath>/attachment.csv"
htmlfile="output.html"
java -cp $CLASSPATH:$CLASSPATH/ojdbc6.jar ClassFile > $ReportFile
awk -F, 'BEGIN{
FS=",";
print "data shown as below"
print "<html><body><table>"
}
{
for(i=1; i<=NF; i++)
{
print "<td>" $i "</td>"
}
print "</tr>"
}
END{
print "<html><body><table>"
}
' $ReportFile > $htmlfile
/home/mailsend-smtp $smtpserver -content-type 'text/html' -mime-type
"text/html html" -t $receiver -f $sender -sub "$subject" -msg-body
$htmlfile -attach $ReportFile