| 您的位置:首页 > 文档 > Shell > |
文章分类热门文章 |
unix命令行如何发送附件创建:2005-10-26 00:49:45 作者:Unlinux 来自: http://www.Unlinux.com The script show how to send mail with attachment in UNIX. The attchment is an ascii file.(Binary file should have another tool to convert it) . #!/bin/ksh #mail infomation filename=test.csv subject="test email with attachment" body="This is a test mail." MAILFROM=rollingpig@163.com MAILTO=serol_luo@gmail.com #boundary is random string to seperate parts of mail boundary=396d983d6b89a #temporay file,to store mail content tmpfile=/tmp/a.tmp cat > $tmpfile <<EOF Return-Path: <$MAILFROM> From:<$MAILFROM> To:<$MAILTO> Content-type: multipart/mixed; boundary="$boundary" Subject: $subject --396d983d6b89a Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 8bit $body --$boundary Content-disposition: inline; filename=$filename EOF cat $filename >>$tmpfile echo --$boundary-- >> $tmpfile mail $MAILTO < $tmpfile 转载自:http://www.unlinux.com/doc/shell/20051026/226.html 【评论】 【加入收藏夹】 【大 中 小】 【打印】 【关闭】 ※ 相关链接
|