Email problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • LutherRevisited

    #1

    Email problem

    Ok, I'm putting my email message together this way:
    for x in M.retr(i)[1]:
    stringMail += x
    stringMail += '\n'
    inMail = email.message_f rom_string(stri ngMail)
    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?
  • Josiah Carlson

    #2
    Re: Email problem

    > Ok, I'm putting my email message together this way:[color=blue]
    > for x in M.retr(i)[1]:
    > stringMail += x
    > stringMail += '\n'
    > inMail = email.message_f rom_string(stri ngMail)
    > 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?[/color]

    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.r strip())
    inMail = email.message_f rom_string('\r\ n'.join(mail))

    Try that out and see how it works.

    - Josiah

    Comment

    • LutherRevisited

      #3
      Re: Email problem

      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.

      Comment

      Working...