Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - General Queries (http://www.outlookbanter.com/outlook-general-queries/)
-   -   Custom Rules (http://www.outlookbanter.com/outlook-general-queries/15810-custom-rules.html)

[email protected] May 25th 06 04:28 PM

Custom Rules
 
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.


Sue Mosher [MVP-Outlook] May 25th 06 05:19 PM

Custom Rules
 
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/comm....program_v ba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

wrote in message oups.com...
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.



All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com