Problem with exchange mail server

Discussion in 'Python' started by Vinayakc, Nov 28, 2005.

  1. Vinayakc

    Vinayakc Guest

    I am new for python. I have written one code which generates RFC2822
    file.
    I have header in string format.

    i am using following code.

    emailData[SMTP_HEADER_POS] = emailData[SMTP_HEADER_POS].encode("utf-8")
    hdr = email.message_from_string(emailData[SMTP_HEADER_POS])
    tmpContentType = msg['Content-Type']
    del msg['Content-Type']

    for key in hdr.keys():
    values = hdr.get_all(key)
    if values != None:
    if key not in msg:
    for value in values:
    msg.add_header(key,value)

    if msg['Content-Type'] is None or msg['Content-Type'] == '':
    msg['Content-Type'] = tmpContentType

    is this right way to add the header??

    This code is not doing well for exchange server mails. Python could not
    parse this mail header. Because first line is 'Microsoft exchange mail
    server version 2.0'.
    If I remove this line, it works. Could not understand this. Please
    help.

    Thanks and Regards
    Vinayakc
    Vinayakc, Nov 28, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RedEye
    Replies:
    2
    Views:
    3,274
    RedEye
    Nov 18, 2003
  2. =?Utf-8?B?ZmFoYWRvbWFu?=

    How to send an e-mail from asp .net using exchange server?

    =?Utf-8?B?ZmFoYWRvbWFu?=, Jul 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,033
    Landi
    Jul 26, 2005
  3. www.westerncartooncards.ca

    Exchange Links < Western Cartoon Cards > Exchange Links

    www.westerncartooncards.ca, Jul 12, 2004, in forum: HTML
    Replies:
    2
    Views:
    1,214
    Toby Inkster
    Jul 12, 2004
  4. martin smith
    Replies:
    3
    Views:
    321
    Jeff Cochran
    Mar 21, 2005
  5. Alessandro Barracco

    matrix: exchange rows + exchange columns

    Alessandro Barracco, Jan 25, 2011, in forum: Ruby
    Replies:
    0
    Views:
    150
    Alessandro Barracco
    Jan 25, 2011
Loading...

Share This Page