Custom Rules

  • Thread starter Thread starter tmort
  • Start date Start date
T

tmort

I'd like to set up something to send an acknowledgment to certain
emails. The actions I want to do are not supported by the Rules
Wizard, so basically if an email has a certain string in the subject or
body I want to run some code.

In more detail the code the look for an ID withing the above string and
then use this as a value in a SQL statement on an Access database to
get the correct email to send an acknowledgement to (it has to be a
different email than what it originates from for security puroposes).

Another factor is we use Scalix as our email server.

I'm really not sure how to begin. I think I can handle the SQL and
sending mail stuff, but, I don't know how to make a rule or how Scalix
plays into things.

I'd consider an add in too that could do this.

Thanks for any help.
 
A "run a script" rule action in Outlook 2002 or later uses a VBA procedure with a MailItem or MeetingItem as its parameter. That item is processed by the code:


Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem

strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
MsgBox msg.SUbject

Set msg = Nothing
Set olNS = Nothing
End Sub

See http://www.outlookcode.com/d/code/zaphtml.htm#ol2002 for another example.

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
 
Back
Top