第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Mailx發(fā)送html消息

Mailx發(fā)送html消息

翻翻過去那場雪 2019-12-05 15:59:50
我想用Mailx發(fā)送html消息。當(dāng)我嘗試以下命令時mailx -s "Subject"  user@gmail.com  < email.html 我得到純文本形式的email.html的內(nèi)容。在消息中,標(biāo)題Content-Type設(shè)置為text / plain。-a選項(xiàng)嘗試發(fā)送文件,因此我不知道如何修改標(biāo)頭。這個答案幾乎可以用,它可以將Content-Type設(shè)置為text / html,但是不能替代默認(rèn)的Content-Type text / plain。mailx -s "$(echo -e "This is the subject\nContent-Type: text/html")" user@gmail.com  < email.html給出這個結(jié)果:From: send@gmail.comTo: user@gmail.comSubject: This is the subjectContent-Type: text/htmlMessage-ID: <538d7b66.Xs0x9HsxnJKUFWuI%maikeul06@gmail.com>User-Agent: Heirloom mailx 12.4 7/29/08MIME-Version: 1.0 boundary="=_538d7b66.z5gaIQnlwb1f/AOkuuC+GwF1evCaG/XIHQMbMMxbY6satTjK"This is a multi-part message in MIME format.--=_538d7b66.z5gaIQnlwb1f/AOkuuC+GwF1evCaG/XIHQMbMMxbY6satTjKContent-Type: text/plain; charset=us-asciiContent-Transfer-Encoding: 7bitContent-Disposition: inline<html><body><p>Helo wolrd</p></body></html>PS:我也嘗試過使用uuencode。當(dāng)我嘗試在網(wǎng)絡(luò)郵件中顯示消息時,我得到一個空白頁...
查看完整描述

3 回答

?
動漫人物

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超10個贊

很簡單,如果您的mailx命令支持-a(append header)選項(xiàng):


$ mailx -a 'Content-Type: text/html' -s "my subject" user@gmail.com < email.html

如果不是,請嘗試使用sendmail:


# create a header file

$ cat mailheader

To: user@gmail.com

Subject: my subject

Content-Type: text/html


# send

$ cat mailheader email.html | sendmail -t


查看完整回答
反對 回復(fù) 2019-12-05
?
蝴蝶不菲

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個贊

幾年來,我已經(jīng)在Arch Linux(該-a標(biāo)志用于附件)上成功使用了以下命令:


mailx -s "The Subject $( echo -e "\nContent-Type: text/html" user@gmail.com < email.html

這將Content-Type標(biāo)頭附加到主題標(biāo)頭,該標(biāo)頭在最近更新之前一直有效?,F(xiàn)在,新行已從-s主題中過濾掉。據(jù)推測,這樣做是為了提高安全性。


現(xiàn)在,我不再依賴于修改主題行,而是使用bash子外殼程序:


(

    echo -e "Content-Type: text/html\n"

    cat mail.html

 ) | mail -s "The Subject" -t user@gmail.com

而且由于我們實(shí)際上僅使用mailx的subject標(biāo)志,所以似乎沒有理由不sendmail按照@dogbane的建議切換到:


(

    echo "To: user@gmail.com"

    echo "Subject: The Subject"

    echo "Content-Type: text/html"

    echo

    cat mail.html

) | sendmail -t

bash子shell的使用避免了創(chuàng)建臨時文件的麻煩。


查看完整回答
反對 回復(fù) 2019-12-05

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號