Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problem with exchange mail server

Thread Tools

Problem with exchange mail server

Posts: n/a
I am new for python. I have written one code which generates RFC2822
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:

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

Thanks and Regards

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot send mail from Exchange 2007 mailbox to Exchange 2003 mailb =?Utf-8?B?am9zdWU=?= MCSE 3 08-15-2007 12:02 PM
Sending Mail Using ASP/VBScript to Exchange Mail Box martin smith ASP General 3 03-21-2005 06:45 PM
Configuring SQL Server with Mail Session(Exchange Server) Aibak MCSE 3 04-08-2004 07:04 AM
Exchange 5.5 with Exchange 2000 Cluster problem Jose Luis Microsoft Certification 0 02-13-2004 10:23 AM
help: My exchange lost M: and exchange can not start winman MCSE 9 07-30-2003 04:34 PM