簡體   English   中英

使用ssmtp隨郵件一起發送HTML電子郵件(sendmail)

[英]Using ssmtp to send HTML e-mails with mail (sendmail)

我將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

revaliases

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之前,它現在可以正常工作,它正在發送HTML,如<b>Bold</b>代碼,但我想像Bold一樣將ssmtp與mail(sendmail)一起使用。

您需要設置其他MIME-Version: 1.0標頭:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM