How do I use MAPI to send an email alert

I want to send alerts automatically from windows. For example in Performance Logs and Alerts, when the processer hits 90% the alert will trigger and sends an email to a user. I know that using MAPI should be the way to do this but I don't know a thing about MAPI. Any help would be appreciated.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

ampcatsConnect With a Mentor Commented:
I cheat and use

to send help messages
I've use wmi with vbscript to do what you seek.  Here's an example of a sendmail function using MAPI with vbscript.  Please note, in Outlook 2002 this isn't going to work for you because you need tell Outlook to allow access to the application and the permissions can only be set for a certain period of time.  

Let me know if you need full examples of the performance monitoring and the MAPI stuff and I can provide them.

Function SendEmail(xAddress, xSubject, xText, ByVal xAttachments)
 ' "xAttachments" - tablou unidimensional:
 '                  lista fisierelor atasate.
 Dim objSession As Object, objMessage As Object
 Dim objOneRecip As Object
 Dim i As Integer

 On Error GoTo error_sendMsg

 Set objSession = CreateObject("MSMAPI.MAPISession")
 Set objMessage = CreateObject("MSMAPI.MAPIMessages")
 objMessage.SessionID = objSession.SessionID
 objMessage.MsgIndex = -1
 objMessage.RecipAddress = xAddress
 objMessage.AddressResolveUI = False
 objMessage.MsgSubject = xSubject
 objMessage.MsgNoteText = xText
 If IsArray(xAttachments) Then
  For i = 0 To UBound(xAttachments)
    objMessage.AttachmentIndex =objMessage.AttachmentCount
    objMessage.AttachmentPathName = xAttachments(i)
 End If
 objMessage.Send False
 On Error GoTo 0
 SendEmail = True
 Exit Function
 On Error GoTo 0
 SendEmail = False
End Function

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.