Hello Robert,
many thanks for your reply, much appreciated...
1. I wonder if you could explain what are "MAPI mail credentials in OS environment"? I'm afraid I do not know what these are and where exactly they need to be set.
2. This is the code I am using:
function SendEmail(mFrom, mTo, mSubject, mBody, mAttach)
{
var i, schema, mConfig, mMessage;
try
{
schema = "http://schemas.microsoft.com/cdo/configuration/";
mConfig = Sys.OleObject("CDO.Configuration");
mConfig.Fields.Item(schema + "sendusing") = 2; // cdoSendUsingPort
mConfig.Fields.Item(schema + "smtpserver") = "xxx.mail.xxx"; // SMTP server
mConfig.Fields.Item(schema + "smtpserverport") = 25; // Port number
mConfig.Fields.Item(schema + "sendusername") = "xxx@xxx.xx"; // User name (if needed)
mConfig.Fields.Item(schema + "sendpassword") = "xxx"; // User password (if needed)
mConfig.Fields.Update();
mMessage = Sys.OleObject("CDO.Message");
mMessage.MimeFormatted = true;
mMessage.Configuration = mConfig;
mMessage.From = mFrom;
mMessage.To = mTo;
mMessage.Subject = mSubject;
mMessage.HTMLBody = mBody;
mMessage.AddAttachment(mAttach); //mAttach is a string with full path to .mht file e.g. "C:\temp\MyResults.mht"
mMessage.Send();
}
catch (exception)
{
Log.Error("E-mail cannot be sent", exception.description);
return false;
}
Log.Message("Message to <" + mTo + "> was successfully sent");
return true;
}
Thanks again,
Marin