Email problem

L

LutherRevisited

Ok, I'm putting my email message together this way:
for x in M.retr(i)[1]:
stringMail += x
stringMail += '\n'
inMail = email.message_from_string(stringMail)
What I'm finding is in the html part of the message '='s are added to the end
of lines that don't end in a tag which is completely messing up the display in
my WxHTMLWindow I use to display messages. Any thoughts?
 
J

Josiah Carlson

Ok, I'm putting my email message together this way:
for x in M.retr(i)[1]:
stringMail += x
stringMail += '\n'
inMail = email.message_from_string(stringMail)
What I'm finding is in the html part of the message '='s are added to the end
of lines that don't end in a tag which is completely messing up the display in
my WxHTMLWindow I use to display messages. Any thoughts?

One thing you should always do when creating email is making sure that
lines end with a CRLF pair. Lines that only end with one or the other
but not both are not RFC 2822 compliant. It may be the case that the '='
are added to lines that are ended improperly.

To fit in with what you are doing above:
stringMail += x.rstrip() + '\r\n'

Though I would suggest against the generally slow repeated string
concatenation (for large numbers of concatenations), replacing it with:
mail = []
for x in M.retr(i)[1]:
mail.append(x.rstrip())
inMail = email.message_from_string('\r\n'.join(mail))

Try that out and see how it works.

- Josiah
 
L

LutherRevisited

Thanks for the advice, that is a much more efficient way of getting the message
together. It didn't help though. I probably should add that the problem with
the '='s added in has occured so far in my limited testing with AOL and
ubi.com, other's have not had that problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,209
Messages
2,571,088
Members
47,686
Latest member
scamivo

Latest Threads

Top