Hi,

according to
http://msdn.microsoft.com/en-us/library/cc839695.aspx
writing to the PR_BODY property of a mapi message should be done more or less like the following:

def TextToStream(mapi_object, text):
    prop_id = PR_BODY_A
    stream = mapi_object.OpenProperty(prop_id,
                                      pythoncom.IID_IStream,
                                      0, mapi.MAPI_MODIFY)
    print stream.Stat(0)
    print stream.Write('papperlapapp\n'*10)
    mapi.RTFSync(mapi_object,
                 mapi.RTF_SYNC_BODY_CHANGED|mapi.RTF_SYNC_RTF_CHANGED)
    stream.Commit(1)
    del stream   # instead of calling Release, which I could not find

write should return the number of bytes written but it returns None here. In case it makes a difference: I am not creating a new message rather than trying to modify the body of an existing one. I learned much from the spambayes project how to properly read message bodies but I cannot find more information on write access.

Any pointers highly appreciated.

Regards, Christian

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to