Search code examples
outlookoutlook-redemption

Changing SenderName in a .msg file


How can I change the property SenderName and SenderEmailAddress in a .msg file, not from within Outlook?

I know that this is not possible with the Outlook COM, because it is a read only property.

I tried using the class Redemption.RDOSession and the method GetMessageFromMsgFile but all the properties were null.


Solution

  • Sure, it is very easy:

    string rdoAddressID = rdoSession.CreateOneOffEntryID("Joe the User", "SMTP", "address@email.com", Type.Missing, Type.Missing);
    Redemption.RDOAddressEntry entry = rdoSession.GetAddressEntryFromID(rdoAddressID, Type.Missing);
    mail.Sender = entry;