Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Rules don't apply to report messages

Status
Not open for further replies.

greensweater

Technical User
Nov 20, 2002
54
Hi, thanks for viewing. I am trying to get Outlook 2003 to forward bounced messages to another machine. To do this I've made a rule that catches most subject lines ("undeliverable", "returned mail" etc).

It works, somewhat. Unfortunately, it only works on messages of type "message" not of type "report". Is there a way to apply rules to report-type messages?
 
Reports don't have the same methods as regular messages. This VBA script uses the NewMailEx event when a message is received to create a normal message with the report's important properties. (may need to use more InStr to handle all report subject lines...)

Code:
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
 entries = Split(EntryIDCollection, ",")
 For Each entry In entries
  Set myItem = Application.Session.GetItemFromID(entry)
  If InStr(myItem.Subject, "Undeliverable") Then
    Set myForward = Application.CreateItem(olMailItem)
    myForward.Body = myItem.Body
    myForward.Subject = myItem.Subject
    myForward.Recipients.Add "huh@huh.com"
    myForward.Send
    Set myForward = Nothing
  End If
 Next entry   
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top