我在发送电子邮件时对电子邮件中的内容类型感到困惑。我知道附件文件类型与内容类型有关。出于某种原因,我无法使用" application / octet -stream&#34 ;. 例如,我想发送" pdf"附件。
s = "David Joyner, Ashok Goel, Nic Papin"
s_list = s.split()
s_result = ""
for i,name in enumerate(s_list):
# Even number elements are first names and should be turned into single letters.
if i % 2 == 0:
inital = name[0]
else:
# Since we only split on spaces, in the odd case, name has a comma already appended.
s_result += name + " " + inital + "., "
# [:-2] removes both the trailing space and the comma.
print(s_result[:-2])
# Joyner, D., Goel, A., Papin N.
信息如下:
两个内容类型:smtp标题信息和附件标题? 他们会相互影响吗? 并且" docx" ---可以使用application / msword吗? 请原谅我提出这个愚蠢的问题! 谢谢你的帮助!
答案 0 :(得分:0)
smtp标头很可能就像:
Content-Type: multipart/related; boundary="----=_NextPart_01D2B948.420196F0"
消息的每个部分都有自己的上下文类型,如下所示:
------=_NextPart_01D2B948.420196F0
Content-Location: file:///C:/18F2A310/testpage.htm
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"
标题不会相互影响。如果您打开一条eml消息或将Outlook消息保存为MHT格式,您将播种MIME代码详细信息。
通过此链接,您可以找到支持的应用程序上下文类型:Media Types