from:https://community.dynamics.com/forums/p/12848/31227.aspx
I would change sendMail() return value from void to boolean and change it's code to something like this:
public boolean sendMail()
{
InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
COMError comErr;
Counter cnLines;
boolean ret = true;
;
try
{
cnLines = infolog.line();
permission.assert();
//BP Deviation Documented
_COM.send();
}
catch(Exception::CodeAccessSecurity)
{
throw Exception::CodeAccessSecurity;
}
catch
{
// delete senseless error message(s)
infolog.cut(cnLines + 1);
//BP Deviation Documented
comErr = oMailer.error();
if (comErr)
{
ret = checkFailed(strfmt(@"Error sending mail in %1: %2 (0x%3)",
comErr.source(),
comErr.description(),
int2hex(comErr.number())
));
}
else
{
//BP Deviation Documented
ret = checkFailed(strfmt(@"Error sending mail to: %1", _COM.to()));
}
}
return ret;
}
In this case you can check the return value from your calling code to find out if the sending has succeded.