Recently I was asked from a client of mine, if is it possible to have all sent mails, from 5 specific accounts, to be sent to his mailbox.They are using Google Apps Free as e-mail hosting solution and Outlook 2003/2007 with POP3/SMTP as e-mail client.I dug through different forums and I was unable to find a way to filter outgoing messages on Gmail.It seemed that the only option was to setup an internal mail server which will forward all outgoing mails to the specific recipient.As you understand this is too much work to do so I thought may be I could find a vbscript for Microsoft Outlook instead which will do the dirty job.So I found it and I am sharing it with you! I have to thank the programmer who made this script.You can find the original page here.
So the steps:
- Open Outlook and navigate at Tools -> Macro -> Visual Basic Editor.
- In the Project listing (upper left box on the screen), expand Project1 (VbaProject.OTM) and within that expand Microsoft Office Outlook Objects.
- Double-click the ThisOutlookSession project to open it. In most cases this is empty, unless you’ve already been modifying your copy of Outlook with macros and such.
- In the code window that opens up, choose Application from the left most drop-down list box, andItemSend from the other (it might automatically be selected for you).
You should be presented with something like this:
6. Copy and paste the following code after the Private Sub line and before the End Sub line:
Dim objRecip As Recipient Dim strMsg As String Dim res As Integer Dim strBcc As String On Error Resume Next ' #### USER OPTIONS #### ' address for Bcc -- must be SMTP address or resolvable ' to a name in the address book strBcc = "SomeEmailAddress@domain.com" 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
Note: Be sure to replace SomeEmailAddress@domain.com with your intended email address. To test your changes you may wish to temporarily it to a secondary email address (like a Gmail account), to make sure all is working correctly.
7. Save the VbaProject.OTM file, close the Visual Basic editor, return to Outlook, and start sending messages.
8. Lower or Disable security in macro settings.