CSMTPConnection is an ATL (VC++) class in atlsmtpconnection.h. Code:
static _TCHAR mailserver[ 256 ];
static _TCHAR mailsender[ 256 ];
static _TCHAR mailrecips[ 256 ];
static _TCHAR subject[ 256 ];
static _TCHAR msg[ 256 ];
static DWORD mailtimeout=10000;
static CSMTPConnection con;
...
if (con.Connect( mailserver, mailtimeout )){
if (con.SendSimple( mailrecips, mailsender, subject, msg)) {
// it worked
} else {
// it failed
}
} else {
// it failed
}
Built with VS2005. Deployed in a service on a mixture of Windows 2008 and Windows 2003 servers (about 10). Works everywhere except on ONE of the windows 2003 servers, where the SendSimple method (or it might be the Connect) ALWAYS produces error 997 - Overlapped I/O operation in progress. I suppose I could just keep calling SendSimple in a loop till I don't get the error, but will that work?