gpt4 book ai didi

linux - 使用ssmtp用mail发送HTML邮件(sendmail)

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:48:31 28 4
gpt4 key购买 nike

我的 ssmtp 配置如下:

ssmtp.conf

root=postmaster
mailhub=smtp.office365.com:587
Hostname=localhost
FromLineOverride=YES
AuthUser=user@domain.com
AuthPass=mypassword
UseSTARTTLS=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

重估

root:user@domain.com:smtp.office365.com:587

邮件代码是:

echo "HTML formatted message goes here like <b>Bold</b><br /><i>Italic</i>" | mail -s "$(echo -e "Subject \nContent-Type: text/html")"  -r fromEmail@domain.com toemail@domain.com.

在配置 ssmtp 之前它工作正常,现在它正在发送类似 <b>Bold</b> 的 HTML代码,但我想像 Bold 一样将 ssmtp 与邮件 (sendmail) 一起使用。

最佳答案

您需要设置额外的 MIME-Version: 1.0 header :

echo "HTML formatted message goes here like <b>Bold</b><br /><i>Italic</i>" | mail -s "$(echo -e 'Subject \nContent-Type: text/html\nMime-Version: 1.0')"  -r fromEmail@domain.com toemail@domain.com

关于linux - 使用ssmtp用mail发送HTML邮件(sendmail),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34333643/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com