I want to change recipient's email address when sending a message. I don't know if I should work with item.to or rec.addressentry or myrecipient.
When I enter specific address I want it to either rewrite after send or just reroute it to another address but never to the specific address. So I prohibit (e-mail address removed) and send it to (e-mail address removed).
Codes below either do not work or can't press send button or it jumps to outbox.
I tried these codes:
'Item = MailItem If Item.To = "(e-mail address removed)" Then Item.To = "(e-mail address removed)"
This not working too:
If InStr(1, Rec.AddressEntry, "(e-mail address removed)", vbTextCompare) Then newEm = "(e-mail address removed)" End If Set myRecipient = myItem.Recipients.Add(newEm) myRecipient.Type = Rec.Type
this one too does not work:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Item.To = ChangeSMTPRecipient(Item, "(e-mail address removed)", "(e-mail address removed)") End Sub
When I enter specific address I want it to either rewrite after send or just reroute it to another address but never to the specific address. So I prohibit (e-mail address removed) and send it to (e-mail address removed).
Codes below either do not work or can't press send button or it jumps to outbox.
I tried these codes:
'Item = MailItem If Item.To = "(e-mail address removed)" Then Item.To = "(e-mail address removed)"
This not working too:
If InStr(1, Rec.AddressEntry, "(e-mail address removed)", vbTextCompare) Then newEm = "(e-mail address removed)" End If Set myRecipient = myItem.Recipients.Add(newEm) myRecipient.Type = Rec.Type
this one too does not work:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Item.To = ChangeSMTPRecipient(Item, "(e-mail address removed)", "(e-mail address removed)") End Sub