'How do I change the 'From' value of mail failure items?
I'm exporting/extracting mail failure items located in a subfolder named 'Subfolder' to a local folder on my laptop using this Outlook code:
Private Sub DBC1()
Set inbox = Session.GetDefaultFolder(6).Folders("Subfolder")
For Each m In inbox.Items
intCount = m.Attachments.Count
If intCount > 0 Then
For i = 1 To intCount
m.Attachments.Item(i).SaveAsFile "C:\info\" & _
m.Attachments.Item(i).FileName
Next
End If
Next
End Sub
I need to change the sender address. How do I change the 'From' value?
Solution 1:[1]
Even though you can open an MSG file using Namespace.OpenSharedItem
, Outlook Object Model will not let you modify the sender related properties using MailItem.PropertyAccessor.SetProperty
(it likes being the Big Brother who knows best).
If using Redemption (I am its author) is an option, you can use RDOSession.GetMessageFromMsgFile
to open an MSG file (returns RDOMail object), then either wipe out the sender setting RDOMail.Sender
/ SentOnBehalfOf
to Nothing (null) or set them to a valid RDOAddressEntry object.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |