• 【Linux】【sendmail】利用sendmail发送带附件的邮件及解决邮件中文标题乱码


    #收件邮箱列表
    TO_LIST=$1
    #邮件标题
    MAIL_TITLE=$2
    #附件地址
    LOG_PATH=$3
    
    fromAdd="=?UTF-8?B?`echo $MAIL_TITLE | base64`?="   
    tolist="$TO_LIST"
    cclist=""
    subject="=?UTF-8?B?`echo $MAIL_TITLE | base64`?="
    attach="$LOG_PATH"
    data=`cat $attach`
    (
    echo "From: $fromAdd"
    echo "To: $tolist"
    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 "<h1>Please check the attachment log.</h1>"
    echo
    echo "--GvXjxJ+pjyke8COw"
    echo "Content-Type: text/plain; charset=US-ASCII;"
    echo "Content-Disposition: attachment;filename="build.log""
    echo 
    echo "$data"
    echo
    echo "--GvXjxJ+pjyke8COw"
    ) | /usr/lib/sendmail -t

     在中文的左边加    =?UTF-8?B?`echo  ,右边加  | base64`?=

  • 相关阅读:
    hdu 5151 Sit sit sit
    hdu 5150 Sit sit sit
    cf C. Arithmetic Progression
    hdu 5125 magic balls
    Pots(bfs)
    Prime Path(素数筛选+bfs)
    A Knight's Journey(dfs)
    Colored Sticks (字典树哈希+并查集+欧拉路)
    Squares(哈希)
    Gold Balanced Lineup(哈希表)
  • 原文地址:https://www.cnblogs.com/jxd283465/p/11595995.html
Copyright © 2020-2023  润新知