I want to write a code in VBA outlook 2016 to send a BCC in every mail I send, I have many senders mail , many emails on one outlook account.
so every time i will send an email from x@domaine.com , automatically sendS a BCC email from x@domaine.com , same if I send from y@domaine1.com will send a BCC to y@domaine1.com
i tried this code but it doesn't work , and in my security macro all is enabled
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
Dim myOlApp As Outlook.Application
Dim myOlMsg As Outlook.MailItem
On Error Resume Next
Set myOlApp = CreateObject("Outlook.Application")
Set myMsg = myOlApp.ActiveInspector.CurrentItem
strBcc = myMsg.SenderEmailAddress
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub