C
craig.jarchow
If your work is using Microsoft Exchange like most enterprises, you'll
notice that by default it is setup so that can't create a rule in
Outlook to automatically forward emails outside of the company. This
is done for security/confidentiality reasons.
If your work doesn’t have the blackberry option or perhaps they won’t
issue you one and you happen to have a personal smart phone (Windows
Mobile, Blackberry, iPhone) and want to forward your emails there, or
perhaps you just want to forward emails to your personal account, I
have a solution for you!
I have written a Macro which forwards my incoming email automatically
bypassing the Exchange server security which prevents a rule from
doing this. I have also added some logic to only do this under the
following circumstances (so I don’t unnecessarily forward emails):
1. It is after hours (from 5pm to 9am)
2. It is during lunch (from 12pm to 1pm)
3. I am currently in a meeting
Below is the code. Simply load Visual Basic from Outlook, open the
ThisOutlookSession module and paste it in. Good luck!
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim varEntryIDs
Dim objItem
Dim i As Integer
Dim bSend As Boolean
Dim fwdItem As Outlook.MailItem
On Error Resume Next
bSend = False
If Hour(Now) > 17 Or Hour(Now) < 9 Then 'After hours
bSend = True
ElseIf Hour(Now) = 12 Then 'Lunch
bSend = True
ElseIf checkBusy Then 'In meeting
bSend = True
End If
If bSend Then
varEntryIDs = Split(EntryIDCollection, ",")
For i = 0 To UBound(varEntryIDs)
Set objItem =
Application.Session.GetItemFromID(varEntryIDs(i))
Set fwdItem = objItem.Forward
fwdItem.Recipients.Add "(e-mail address removed)"
fwdItem.Send
Next
End If
End Sub
Private Function checkBusy() As Boolean
Dim olApp As Outlook.Application
Dim strFreeBusy As String
Dim pos As Integer
strFreeBusy = Application.Session.CurrentUser.freeBusy(Now,
30, True)
pos = ((Hour(Now) * 60) + Minute(Now)) / 30
If InStr(Mid(strFreeBusy, pos - 1, 3), "2") > 0 Then
checkConflict = True
Return
End If
checkConflict = False
End Function
notice that by default it is setup so that can't create a rule in
Outlook to automatically forward emails outside of the company. This
is done for security/confidentiality reasons.
If your work doesn’t have the blackberry option or perhaps they won’t
issue you one and you happen to have a personal smart phone (Windows
Mobile, Blackberry, iPhone) and want to forward your emails there, or
perhaps you just want to forward emails to your personal account, I
have a solution for you!
I have written a Macro which forwards my incoming email automatically
bypassing the Exchange server security which prevents a rule from
doing this. I have also added some logic to only do this under the
following circumstances (so I don’t unnecessarily forward emails):
1. It is after hours (from 5pm to 9am)
2. It is during lunch (from 12pm to 1pm)
3. I am currently in a meeting
Below is the code. Simply load Visual Basic from Outlook, open the
ThisOutlookSession module and paste it in. Good luck!
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim varEntryIDs
Dim objItem
Dim i As Integer
Dim bSend As Boolean
Dim fwdItem As Outlook.MailItem
On Error Resume Next
bSend = False
If Hour(Now) > 17 Or Hour(Now) < 9 Then 'After hours
bSend = True
ElseIf Hour(Now) = 12 Then 'Lunch
bSend = True
ElseIf checkBusy Then 'In meeting
bSend = True
End If
If bSend Then
varEntryIDs = Split(EntryIDCollection, ",")
For i = 0 To UBound(varEntryIDs)
Set objItem =
Application.Session.GetItemFromID(varEntryIDs(i))
Set fwdItem = objItem.Forward
fwdItem.Recipients.Add "(e-mail address removed)"
fwdItem.Send
Next
End If
End Sub
Private Function checkBusy() As Boolean
Dim olApp As Outlook.Application
Dim strFreeBusy As String
Dim pos As Integer
strFreeBusy = Application.Session.CurrentUser.freeBusy(Now,
30, True)
pos = ((Hour(Now) * 60) + Minute(Now)) / 30
If InStr(Mid(strFreeBusy, pos - 1, 3), "2") > 0 Then
checkConflict = True
Return
End If
checkConflict = False
End Function