Problem
You need to send emails from console on Windows, the way like sendmail on Linux
Solution
Use the script below
function sendMail(from, to, subject, HTMLBody, attachments){
var m = new ActiveXObject("CDO.Message");
var mConf = m.Configuration;
var mConfFields = mConf.Fields;
mConfFields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
mConfFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your smtp server";
mConfFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25;
mConfFields.Update();
m.From = from;
m.To = to;
m.Subject = subject;
m.HTMLBody = HTMLBody;
if (attachments != "") m.AddAttachment(attachments);
m.Send();
}
sendMail("from_address","recipient1 , recipient2,...","subject","email body", "");
var m = new ActiveXObject("CDO.Message");
var mConf = m.Configuration;
var mConfFields = mConf.Fields;
mConfFields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
mConfFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your smtp server";
mConfFields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25;
mConfFields.Update();
m.From = from;
m.To = to;
m.Subject = subject;
m.HTMLBody = HTMLBody;
if (attachments != "") m.AddAttachment(attachments);
m.Send();
}
sendMail("from_address","recipient1 , recipient2,...","subject","email body", "");
No comments:
Post a Comment