none
Get sender's SMTP address using PR_PRIMARY_SEND_ACCT or from the profile

    Question

  • I need to get a sender's SMTP address when the IMessage is being sent. When the message placed in the outbox, PR_SENDER_* are not defined. PR_PRIMARY_SEND_ACCT is and I can use IOlkAccountManager to get the address. I've run into some issues doing that and wonder how I can go directly to the profile to get the info I need? Using IProfAdmin, I can almost get there but not quite. Anyone know how to do this correctly?

    Also, it looks like PR_PRIMARY_SEND_ACCT has the necessary info but it's undocumented. Does anyone know the format? It looks like the second "field" contains PR_SENDER_EMAIL_ADDRESS. What about InternetAccountStamp? Can I use it?

    Tuesday, February 26, 2013 6:08 PM

All replies

  • Are you sending through SMTP or Exchange acount?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, February 26, 2013 6:16 PM
  • IMAP, POP and exchange
    Tuesday, February 26, 2013 6:17 PM
  • IMAP and POP3 account both use SMTP for sending, the SMTP address of the user can be retrieved from the PROP_ACCOUNT_USER_EMAIL_ADDR (0x000C001F) property from IOlkAccountManager.

    For the Exchange account, use PROP_MAPI_IDENTITY_ENTRYID (0x2002102) to open the Exchange user as IMailUser (IAddrBook::OpenEntry), you can then read PR_SMTP_ADDRESS or PR_EMSAB_PROXY_ADDRESSES.

     

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, February 26, 2013 8:07 PM
  • Thanks Dmitry,

    What you describe, I have working. I'm having some issues using IOlkAccountManager, beyond the scope of this conversation. So what I'd like to do is go to the profile directly, if possible. Or parse PR_PRIMARY_SEND_ACCT or InternetAccountStamp but the format's not documented.

    Tuesday, February 26, 2013 8:13 PM
  • IOlkAccountManager data is never stored in the MAPI based IProfAdmin, it is only accessibble through IOlkAccountManager.

    What IOlkAccountManager issues are you having?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!


    Tuesday, February 26, 2013 8:15 PM
  • I've been looking at wrapping the PST. At one point, I need to get a sender's smtp address. PR_SENDER_* isn't available so I use IOlkAccountManager. It needs a IMAPISession so the way I get it is to call MAPILogonEx. That basically works, most of the time. There's at least one use case where it doesn't work so I'd really prefer not to use it. But then I can't use IOlkAccountManager. And so my questions.
    Wednesday, February 27, 2013 12:34 AM