Link to home
Start Free TrialLog in
Avatar of milbank
milbank

asked on

Automatic BCC on all e-mails sent from one outlook account not both

Hi,

I have read and tested all the solutions mentioned on this forum for automatically BCC'ing e-mails to an address.

The problem I am having is that we have 2 e-mail accounts in Outlook and only want one of these accounts to BCC the address not both.

I am using the following code at the moment :

'-----------------------------------------------------------------------
'Macro Begins Here
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objMeBCC As Recipient
    'If the item is a message
    'If Item.Class = olMail Then
        'Trigger the code if the sender name matches
        'If Item.SenderEmailAddress = "Email@address.co.uk" Then
            'Add a recipient
            Set objMeBCC = Item.Recipients.Add("Email@address.co.uk")
            'Set the recipient type to BCC
            objMeBCC.Type = olBCC
            objMeBCC.Resolve
            'Item.Recipients.ResolveAll
       End If
    'End If
    'Allow the message to be sent
    Cancel = False
End Sub
'Macro Ends Here
'-----------------------------------------------------------------------

Is there anything that I can add that will select just one account to BCC from?

We have tried using 'If Item.SenderEmailAddress = "Email@address.co.uk" and 'If Item.SenderName = "Email_account_Name_1" but neither of these seem to work. It stops any address being BCC'd

Kind Regards

Barry Thomas
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial