Solved

How do I use MAPI to send an email alert

Posted on 2004-04-29
2
295 Views
Last Modified: 2010-08-05
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.
0
Comment
Question by:ifenton
2 Comments
 
LVL 6

Accepted Solution

by:
ampcats earned 125 total points
Comment Utility
I cheat and use

http://www.muquit.com/muquit/software/mailsend/mailsend.html

to send help messages
0
 
LVL 13

Expert Comment

by:TommyTupa
Comment Utility
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")
 objSession.SignOn
 Set objMessage = CreateObject("MSMAPI.MAPIMessages")
 objMessage.SessionID = objSession.SessionID
 objMessage.Compose
 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)
  Next
 End If
   
 objMessage.Send False
 objSession.SignOff
   
 On Error GoTo 0
 SendEmail = True
 Exit Function
   
 error_sendMsg:
 On Error GoTo 0
 SendEmail = False
   
End Function

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now