A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Using a script for email alerts



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 16th 06, 06:35 AM posted to microsoft.public.outlook.program_vba
Roy N
external usenet poster
 
Posts: 1
Default Using a script for email alerts

I would like to create a rule for Outlook 2003 which will send an email if
certain conditions within the rule are met. The destination address will be
static, as will everything in the email.

I basically want to create an Outlook rule that says "If email from xxx is
received run script" And I want the script to send an email that says "You
received an important email." This same message is always sent to the same
email address.

Seems to me that this would be a very basic script. But I have no idea if
such a script is programmatically possible for Outlook. I have experience
with VB Script (as well as C++ and lots of other programming) but I don't
know the first thing about writing scripts for Outlook.

If what I want to do is possible, let me know and I'll start researching. If
what I want to do is possible and you want to be extra helpful, let me know
and give me some pointers to get me started :-)
Ads
  #2  
Old August 16th 06, 01:18 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Using a script for email alerts

A "run a script" rule action actually uses not an external script but 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

Of course, in your scenario, you don't seem to care about the item, so all you need to do is create a message and send it:

Set mail = Application.CreateItem(olMail)
With mail
.To = "
.Subject = "whatever"
.Body = "some stuff"
.Send
End With

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

"Roy N" wrote in message ...
I would like to create a rule for Outlook 2003 which will send an email if
certain conditions within the rule are met. The destination address will be
static, as will everything in the email.

I basically want to create an Outlook rule that says "If email from xxx is
received run script" And I want the script to send an email that says "You
received an important email." This same message is always sent to the same
email address.

Seems to me that this would be a very basic script. But I have no idea if
such a script is programmatically possible for Outlook. I have experience
with VB Script (as well as C++ and lots of other programming) but I don't
know the first thing about writing scripts for Outlook.

If what I want to do is possible, let me know and I'll start researching. If
what I want to do is possible and you want to be extra helpful, let me know
and give me some pointers to get me started :-)

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script errors arriving in email? Dick Outlook Express 9 May 23rd 07 11:55 AM
Rule 'run a script' not running my script [email protected] Outlook and VBA 3 May 30th 06 12:09 PM
sending email alerts from Sql Server helpful sql Outlook - General Queries 8 April 12th 06 04:10 AM
Junk email and rules and alerts... annoyed Outlook - Installation 1 February 8th 06 07:56 PM
Email alerts for messages directly send to me. Outlook 2003 [email protected] Outlook - General Queries 1 January 31st 06 11:02 PM


All times are GMT +1. The time now is 02:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.