Rules/Macro/VBA Forwarding Question

  • Thread starter Thread starter jeccorp
  • Start date Start date
J

jeccorp

Hi All,

What I am looking to do is the following:

I receive email from a general mailbox that I must sort and send on to
other people. Currently, all email from the general mailbox gets moved
through a rule to a separate folder called "GeneralHelp". This folder
is NOT under the main Inbox.

I go through the "GeneralHelp" folder and determine who will answer the
email and forward it on to them. What I would like to do is have
folders under the "GeneralHelp" named "ToHelp1","ToHelp2",etc that I
will just move the email into these folders, and then they
automatically forward to a specified email address.

I have been all over the groups looking for something like this, and
from what I can tell, it does not seem to be possible to do this with
the standard rules in Outlook. I believe some kind of VB solution
through the editor is the way to do it, but I can not seem to figure
out how to do this.

I am using Outlook 2000 and I am not on Exchange.

If anyone can point me in the right direction, that would be greatly
appreciated.

Thanks
jeccorp
 
Yes, this can be done with VBA. You'd set up a handler for the MAPIFolder.Items.ItemAdd event for each folder. That event passes the added Item as a parameter, so your code for the event handler would just forward that item to the desired recipient.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Hi All,

I could not find a specific example of what I was looking for on any of
the groups, but I did piece together the following code that does work.
When the email is dropped into a folder, it then emails the file to
the recipient:

'-----Start
Public WithEvents myOlItems As Outlook.Items

Public Sub Application_Startup()

Set myOlItems = Outlook.Session.Folders("Personal
Folders").Folders("TestBox").Folders("ToRussell").Items

End Sub


Private Sub myOlItems_ItemAdd(ByVal Item As Object)

Set myForward = Item.Forward
myForward.Recipients.Add "(e-mail address removed)"
myForward.Send

End Sub
'-----End

For my purposes, all email to an address are being moved to the TestBox
folder that is NOT under the regular Inbox, but is located under the
root folder in Outlook of Personal Folders. At that point, I have a
bunch of To<Person> folders that I then drop the email into which gets
forwarded on correctly.

Now for my next question, apparently when you do this, Outlook takes
over and needs you to click "Yes" that you acknowledge/allow this email
to be sent on "your behalf". I have looked up and found the Redemption
solution. I have been trying to test it, but I can not figure out how
to enter it into my above code so the email is sent. The following is
what I have come up with. It still sends the email just fine, but I
still get the security questions. Can someone help me modify this so
it works correctly with Redemption?

Thanks,
jeccorp


'-----Start(Redemption Code)
Public WithEvents myOlItems As Outlook.Items

Public Sub Application_Startup()

Set myOlItems = Outlook.Session.Folders("Personal
Folders").Folders("TestBox").Folders("ToRussell").Items

End Sub


Private Sub myOlItems_ItemAdd(ByVal Item As Object)

Set oRdpMail = CreateObject("Redemption.SafeMailItem")

oRdpMail.Item = Item
oRdpMail.Save

Set myForward = oRdpMail.Item.Forward
myForward.Recipients.Add "(e-mail address removed)"
myForward.Send

End Sub
'-----End(Redemption Code)
 
Basic Redemption usage -- objMsg is the Outlook.MailItem being sent (change to fit your scenario):

objMsg.Save
Set rMail = CreateObject("Redemption.SafeMailItem")
rMail.Item = objMsg
rMail.Send

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top