Menu

Sunday, January 8, 2012

Forwarding Outlook Emails to your public Email Account or to your Pager

I was searching ways of forwarding my Outlook emails to my mobile or either to my preferred public email accounts. Unfortunately all the easiest ways were blocked including email forwarding Outlook options, externally forwarding emails through a SMTP server and also forwarding mails from an external program. However, further studying on it I have found a way which is very interesting & no way of blocking it. That is by writing an Outlook Macro.

Using Outlook Macro option you can write a custom VB code as you want as well as trigger your particular code with Outlook events such as when a new email received, etc.
Also you can forward your Outlook emails to any email address, your mobile Pager address through your VB code in a totally customized way. You will be receiving the forwarded email to your public mail account or mobile as same way you sent through the Outlook.

There is no way your system administrator could find out that you are using such a Macro, however, there is a possibility that your mails are blocking from the SMTP server end and due to server failure your code may retrying it forever. Therefore, your administrators would find it due to incoming traffic and failures from your mail account.

So below is the code and use it with your own risk.  
1. MS Outlook 2007 > Tools > Macro > Visual Basic Editor  
2. Copy & paste below code  
3. Provide your public email address, Save and Run it.  
4. This will trigger when you receive a new email address and forward the content to given mail account. Further, you can enhance this as you want by writing events only for your custom Inbox folders, forwarding attachments, etc.

Private Sub Application_NewMail()
Dim objItem As Outlook.MailItem
Dim objMailItem As Outlook.MailItem
Dim sEmailAddress As String
Dim sSubject As String
Dim sBody As String ' Get the item that likely triggered the event.
Set objItem = Application.GetNamespace("MAPI"). _ GetDefaultFolder(olFolderInbox).Items(1) sSubject = objItem.Subject & " From: " & _ objItem.SenderName
sBody = objItem.Body
Set objMailItem = Application.CreateItem(olMailItem)
With objMailItem .Subject = sSubject .Body = sBody .Recipients.Add "YourPublicEmail@gmail.com" .Send End 
With Set objMailItem = Nothing

No comments: