Solved

Forward an Email when it is sent FROM a specific address

Posted on 2011-09-06
5
311 Views
Last Modified: 2012-05-12
We have a user that has exchange permission to send as another user.

How can i get any emails sent my the user as the 2nd user to be automatically forwarded to another account?

I hope i have explained this propperly

Thanks in advance.

Outlook 2007
Exchange 2007
0
Comment
Question by:ict-torquilclark
  • 2
  • 2
5 Comments
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Hi, ict-torquilclark.

I think I can do it with a macro.  Would that be acceptable?
0
 
LVL 1

Author Comment

by:ict-torquilclark
Comment Utility
yes, would it store the macro in the users roaming profile so it would activate whereever he logged on?
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
I believe so, but that's more of a Windows question than an Outlook one and I'm not an expert on Windows and roaming profiles.  I should also mention that the macro will only work for the full Outlook client, not OWA.  

Here's the code I propose.  Since I don't have any delegates I'm not in a position to test it.  The code comes in two parts.  Follow these instructions to add them both to Outlook.

Part 1

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  Right-click on Class Modules, select Insert > Class Module
5.  In the Properties panel click on Name and enter AutoForward
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor

'On the next two lines edit the names/addresses.  The former is the name/address of the account you are sending for, the latter is the address to forward to.'
Const SENT_FOR = "John Doe"
Const FWD_TO = "someone@company.com"

Private WithEvents olkWatchedFolder As Outlook.Items

Private Sub Class_Initialize()
    Set olkWatchedFolder = Outlook.Application.Session.GetDefaultFolder(olFolderSentMail).Items
End Sub

Private Sub Class_Terminate()
    Set olkWatchedFolder = Nothing
End Sub

Private Sub olkWatchedFolder_ItemAdd(ByVal Item As Object)
    Dim olkFwd As Outlook.MailItem
    If Item.Class = olMail Then
        If Item.SentOnBehalfOfName = SENT_FOR Then
            Set olkFwd = Item.Forward
            olkFwd.To = FWD_TO
            olkFwd.Send
        End If
    End If
    Set olkFwd = Nothing
End Sub

Open in new window


Part 2

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comment lines wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools > Trust Center
9.  Click Macro Security
10. Set Macro Security to "Warnings for all macros"
11. Click OK
12. Close Outlook

13. Start Outlook.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

Private objAF As AutoForward

Private Sub Application_Quit()
    Set objAF = Nothing
End Sub

Private Sub Application_Startup()
    Set objAF = New AutoForward
End Sub

Open in new window

0
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
Comment Utility
or a simple outlook rule or a transport rule in exchange.
 Outlook rule.. as an attachment or not your option
0
 
LVL 1

Author Comment

by:ict-torquilclark
Comment Utility
The exchange rule workes wondervully

I didnt know about those
0

Featured Post

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now