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'] prints:-
some header: just wondering just wondering why this sentence is continually cut in half for a reason I can not find
print msg prints:-
some header: just wondering why this sentence is continually cut in half for a
reason I can not find
私が発見したことの1つは、切り取られる長さがヘッダータイトルとその値の組み合わせであるということです。したがって、「someheader」を「some」に短絡すると、行の戻り値が「reason」の前ではなく「after」に変わります。
それは私の閲覧ページ幅だけではありません:)、それは実際に電子メールヘッダーに改行文字を含む電子メールを送信します。
何かご意見は?