Unusual behaviour in setting Sender (Outlook 2016)

Status
Not open for further replies.

Ed Sheehan

Member
Outlook version
Outlook 2016 32 bit
Email Account
Outlook.com (as MS Exchange)
I have two email accounts set-up. An Outlook Exchange based one, and a MAPI based one linked to my personal domain hosting service.

I created the following simple script to all default new emails to always using the personal account as the sender.

The first new email persists with using the Exchange based account, but all subsequent emails (so long as the first email remains open) work perfectly. As soon as I close the first email, the next one reverts back to the Exchange account. Again, all subsequent new emails default correctly.

What am I missing?

'=========================================================================
' Program: Sender
' Description: Force sending account to a specific item when creating new emails
' Called by: Outlook events
'=========================================================================

' Create evnt monitoring object
Dim WithEvents colInsp As Outlook.Inspectors

' Begin monitoring with application startup
Private Sub Application_Startup()
Set colInsp = Application.Inspectors
End Sub

' Event handler
Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class = olMail Then

' Create object to hold mail item
Dim objMail As Outlook.MailItem
Set objMail = Inspector.CurrentItem

' Overide sender account with the first account in profile
If objMail.Sent = False Then
objMail.Sender = Outlook.Session.GetAddressEntryFromID("812B1FA4BEA310199D6E00DD010F5402000000804500640020005300680065006500680061006D00000053004D005400500000006500640040006E006100760065006D002E0063006F")
End If
End If
End Sub
 
Last edited by a moderator:

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I believe the problem is that Exchange is a pig and always wants to be the sender. <g> I'm seeing the same behavior. What's interesting is the entry id is comping up with your name and address - i will edit the entry id in your sample to remove it.
 

Ed Sheehan

Member
Outlook version
Outlook 2016 32 bit
Email Account
Outlook.com (as MS Exchange)
Status
Not open for further replies.
Top