我正在使用 SMTP 并使用 email.mime 来提供标题结构。出于某种原因,当尝试添加超过一定长度的标题时,会在我的标题行中添加换行符。
例如
from email.mime.text import MIMEText
message = 'some message'
msg = MIMEText(message)
msg.add_header('some header', 'just wondering why this sentence is continually cut in half for a reason I can not find')
print msg['some header']
print msg
print msg['some header'] 打印:-
some header: just wondering just wondering why this sentence is continually cut in half for a reason I can not find
打印味精打印:-
some header: just wondering why this sentence is continually cut in half for a
reason I can not find
我确实发现的一件事是,它被截断的长度是标题标题及其值的组合。因此,当我将“某些标题”缩短为“某些”时,行返回更改为“原因”之后而不是之前。
这不仅仅是我查看页面的宽度:),它实际上是在电子邮件标题中发送带有换行符的电子邮件。
有什么想法吗?