InfiniTec - Henning Krauses Blog

Don't adjust your mind - it's reality that is malfunctioning

Where do I come from? - Specifying the sender or author of an Exchange Email with WebDAV

Sometimes you might want to put an email directly in a users mailboox without sending it. Typically you want to set a specific sender on that mail. If you tried this, you'll most probably set the urn:schemas:httpmail:from or urn:schemas:httpmail:sender property to the desired sender name - and got a 403-Forbidden answer from Exchange. Luckily, there are six MAPI properties corresponding to the sender and from address:

  • SenderEmailAddressType (http://schemas.microsoft.com/mapi/proptag/xc1e001f)
  • SenderEmailAddress (http://schemas.microsoft.com/mapi/proptag/xc1f001f)
  • SenderEmailAddressDisplayName (http://schemas.microsoft.com/mapi/proptag/xc1a001f)
  • SentRepresentingEmailAddressType (http://schemas.microsoft.com/mapi/proptag/x64001f)
  • SentRepresentingEmailAddress (http://schemas.microsoft.com/mapi/proptag/x65001f)
  • SentRepresentingEmailAddressDisplayName (http://schemas.microsoft.com/mapi/proptag/x42001f)

The first three properties define the person who actually sent the mail whereas the last three properties define the author or the person on which behalf the mail was sent. If both property sets are set to equal values, Outlook will display just the Name. If they are different, Outlook displays something like "Alice on behalf of Bob". The values you are specifying differ on the type of address you have. This can either be a SMTP address or a Legacy Exchange Distinguished Name. If the email address of Alice is alice@example.com, put these values in the sender properties:

  • SenderEmailAddressType: SMTP
  • SenderEmailAddress: alice@example.com
  • SenderEmailAddressDisplayName: Alice

Outlook will then display the address like this:


Email address properties for an SMTP address (click to enlarge)

If the sender you want to insert is a user on your corporate network you might want to get the Legacy Exchange Distinguished Name from Active Directory. In my lab Exchange, Alice has an Legacy Exchange Distinguished Name of "/o=Contoso Ltd/ou=First Administrative Group/cn=Recipients/cn=alice". This yields the following values for the three properties:

  • SenderEmailAddressType: EX
  • SenderEmailAddress: /o=Contoso Ltd/ou=First Administrative Group/cn=Recipients/cn=alice
  • SenderEmailAddressDisplayName: Alice

Outlook will display this address this way:


Outlook dialog for the details of an Exchange address (click to enlarge)

One additional property you might want to set in this scenario is the MessageFlags (http://schemas.microsoft.com/mapi/proptag/xe070003) property. If you omit this, Outlook will tell you that the message has not been sent. To avoid that message, set the MessageFlags property to 4.


Technorati:

Posted by Henning Krause on Sunday, July 22, 2007 12:00 AM, last modified on Sunday, July 22, 2007 12:00 PM
Permalink | Post RSSRSS comment feed