Correct email format for Email with Plain, HTML and an Attachment in SMTP?

后端 未结 2 1260
北恋
北恋 2021-01-06 02:19

The Problem:

I tried to copy the SMTP based headers/emails used by yahoo and hotmail and send them over Telnet, but the email I get does not display

2条回答
  •  醉梦人生
    2021-01-06 02:49

    It turns out the problem is incredibly subtle.

    Hotmail conventionally (this was the original email I based it on ), uses the term "multipart/alternative" for multiple parts of the email. I used 'multipart/alternative' in my email.

    It turns out yahoo does not like 'multipart/alternative' and will only correctly display the plain text, html and attachment correctly when instead the term 'multipart/mixed' is used (as I noticed yahoo compliant emails use this term instead of alternative), in combination with ejdyksen's suggestion (neither suggestion works by itself for yahoo's server though).

    Although, technically speaking, this is the 'correct' answer, I will leave ejdyksen's answer selected because his efforts had shown it was some server-side technicality (his SMTP server and hotmail's both displayed the attachment, yahoo's didn't). Politely upvote ejdyksen's answer instead as he did most of the legwork.

提交回复
热议问题