sendmail是嵌入式linux 移植的软件bosybox里的一个发送邮箱的命令,支持smtp服务器认证,具体发送格式为:
sendmail -f from@xx.com -t to@xx.com -S smtp.xx.com:端口号 -auXXX -apXXXX < 邮件格式
-f 表示发送者的邮箱
-t 表示接收者的邮箱
-au 表示发送邮箱名
-ap 表示发送邮箱密码
-S smtp服务器域名或IP
邮件格式为:
#!/bin/sh
fromAdd="from@xx.com"
tolist="to@xx.com"
cclist="xx@xx.com"
subject="TextMultipartMixedMail"
attach="hello.txt"
(
echo "From: $fromAdd"
echo "To: $tolist"
echo "To: $tolist1"
echo "Cc: $cclist"
echo "Subject: $subject"
echo "MIME-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw"'
#echo "Content-Disposition: inline"
echo
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: text/html; charset=US-ASCII"
echo "Content-Disposition: inline"
echo
echo "正文内容"
echo
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: text/plain; charset=UTF-8;name=$attach"
echo "Content-Disposition: attachment;filename=$attach"
#echo "Content-Transfer-Encoding: base64"
echo
echo "附件内容"
echo
echo "--GvXjxJ+pjyke8COw"
) | sendmail -f $fromAdd -t $tolist -S smtp.xx.com -auxxx -apxxxxx