I try to store a draft e-mail via IMAP to a folder running on MS Exchange. Everything ok, except that Bcc recipients don't get shown in the draft message stored on the server. Bcc recipients also don't receive the email if I send it with MS Outlook. If I read the message back with Python after I have stored it on the server, I can see the Bcc in the draft.
The following Python code reproduces this behavior:
import imaplib
import time
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
message = MIMEMultipart()
message['Subject'] = 'Test Draft'
message['From'] = '[email protected]'
message['to'] = '[email protected]'
message['cc'] = '[email protected]'
message['bcc'] = '[email protected]'
message.attach(MIMEText('This is a test.\n'))
server= imaplib.IMAP4('the.ser.ver.ip')
server.login('test', 'test')
server.append("Drafts"
,'\Draft'
,imaplib.Time2Internaldate(time.time())
,str(message))
server.logout()
If I run this code, a draft gets stored into the Draft
folder on the Exchange Server. But if I look at the draft with MS Outlook, it does not include the bcc
recipient (message['bcc'] = '[email protected]'
). Message
, to
, from
, cc
ok, no error.
If I download drafts that already include a bcc from an Exchange folder, I can also see the bcc. Only uploading doesn't work for me.
Any help very much appreciated. Thanks. BTW, MAPI is not an option.
Update: Thanks. X-Receiver
didn't work for me. As for playing around with an IMAP-Folder in Outlook, I got an interesting result. If I access the draft via the IMAP-Folder in Outlook, I see the bcc. But if I access it via the MAPI-Folder, I don't see it. Will play a little bit around with that.
Conclusion: thanks for the input. Actually, the code works just fine. See below for the answer that I found.