views:

150

answers:

2

I am programming a process monitoring tool which is written in C++, windows application. Is there anyway to send out alert email when the tool find the process go down? Any library support this? or any solution is fine. Thanks.

+1  A: 

In order to send mail on a Windows box you can use the MAPI interface:

http://msdn.microsoft.com/en-us/library/dd296721(VS.85).aspx

This will use the settings for Outlook/Outlook Express (possibly others) to send it. It may require the user to actually give permission for the e-mail to be sent. (It probably depends on user settings) It will also only work if e-mail is configured correctly on the box.

I have in the past had the program send a web request with the details and used that to send an e-mail. However, that was when my program had crashed and I needed the bug report. I do not think that is what you had in mind.

You could also implement the SMTP connection yourself:

http://stackoverflow.com/questions/58210/c-smtp-example

However, that will require knowing the SMTP settings for the user which may be inconvenient.

Winston Ewert
+1  A: 

POCO has SMTP support

There is also a way to do mail through MS-Outlook http://www.outlookcode.com/

Romain Hippeau