I'm playing around with SMTP and using email.mime to provide the header structure. For some reason when a try to add a header that exceeds a certain length a line break is added into my header line.
e.g.
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
One thing I did discover is that the length at which it's cut off is a combination of the header title and its value. So when I shorted 'some header' to 'some', the line return changes to after 'reason' instead of before.
It's not just my viewing page width :), it actually sends the email with the new line character in the email header.
Any thoughts?