Automatic action upon reception of a message

N

nicola.attico

Hi

I need to execute a script when a message is received by a specific
sender and/or a specific subject and/or it contains some string in the
message text

Can I do that with vba?

Otherwise (even better) can I automatically create a txt
subject_sender.txt in a specific directory with the content of the e-
mail ?

thanks and regards

Nicola Attico
 
S

Sue Mosher [MVP-Outlook]

Consider writing a VBA procedure for use with a "run a script" rule action. Such a procedure has the incoming 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

To create a message using external file content, see http://www.slipstick.com/mail1/html.htm

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top