pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

MAPI support for PR_REPLY_RECIPIENT_ENTRIES

Open ghost opened this issue 15 years ago • 3 comments

I was able to replace most of my existing C++ based sendmail.exe program with a Python script using pythoncom.mapi. Great work! However, I am not able to specify a different Reply-To address, because the mapi package does not support the FLATENTRY and FLATENTRYLIST structures. Note: Working C++ code for specifying a different Reply-To address can be found at http://support.microsoft.com/kb/300531

Reported by: hvbargen

Original Ticket: pywin32/feature-requests/79

ghost avatar Jul 01 '10 14:07 ghost

OK, as a workaround it is possible to modify the reply-to address with a bit low-level code (see below). So, my problem is solved. Anyway, perhaps this could be a nice addition to the mapiutil package.

code fragment to set the replyTo-Address

def makeentry(typ, name_addr): return ((mapitags.PR_RECIPIENT_TYPE, typ), #(mapitags.PR_DISPLAY_NAME_A, name_addr), (mapitags.PR_DISPLAY_NAME_W, name_addr), )

# ReplyTo-Address if replyTo: # replyTo is a unicode string replyToList = address_book.ResolveName(0, mapi.MAPI_UNICODE, None, [makeentry(mapi.MAPI_TO, replyTo)]) props = [(mapitags.PR_REPLY_RECIPIENT_NAMES, replyTo), ] message.SetProps(props) replyToAddr = replyToList[0] for (pt, pv) in replyToAddr: if pt == mapitags.PR_ENTRYID: entryid = pv break #print "reply-to entryid (len %s): %r" % (len(entryid), entryid) flatentry = struct.pack("i", len(entryid)) + entryid #print "flatentry:", repr(flatentry) flatentrylist = struct.pack("ii", 1, len(flatentry)) + flatentry props = [
(mapitags.PR_REPLY_RECIPIENT_ENTRIES, flatentrylist), ] message.SetProps(props)

Original comment by: hvbargen

ghost avatar Jul 02 '10 09:07 ghost

  • priority: 5 --> 3

Original comment by: hvbargen

ghost avatar Jul 02 '10 09:07 ghost

A complete, working example

Original comment by: hvbargen

ghost avatar Jul 02 '10 09:07 ghost