magistic
21-01-2017, 17:31
Здравствуйте!!!
Помогите решить проблему в коде. Нужно чтобы при включении компьютера приходило письмо о его включении от мой код:
Вываливается ошибка: "Транспорту не удалось подключится к серверу"
Помогите разобраться в чем проблема???
var to = "zzz@mail.ru";
var subj = "включение компьютера";
var text = "компьютер включен";
SendMail(to, subj, text);
function SendMail(sRecipientMail, sSubject, sMsgBody,files)
{
try
{
// create a session and log on -- username and password in profile
var refMsg = WScript.CreateObject("CDO.Message");
var refConf = WScript.CreateObject("CDO.Configuration");
// Setting configuration params
with(refConf.Fields)
{
Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.ru";
Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465;
Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1;
Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "zzz@mail.ru";
Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password";
}
refConf.Fields.Update();
with(refMsg)
{
Configuration = refConf;
To = sRecipientMail;
From = "xxx@mail.ru";
Subject = sSubject;
TextBody = sMsgBody;
}
if (files)
{
for(var i=0; i<files.length; i++)
refMsg.AddAttachment(files[i]);
}
refMsg.Send();
}
catch(e)
{
WScript.Echo("SendMail error !!! : " + e.description);
WScript.Quit(1);
}
}
Помогите решить проблему в коде. Нужно чтобы при включении компьютера приходило письмо о его включении от мой код:
Вываливается ошибка: "Транспорту не удалось подключится к серверу"
Помогите разобраться в чем проблема???
var to = "zzz@mail.ru";
var subj = "включение компьютера";
var text = "компьютер включен";
SendMail(to, subj, text);
function SendMail(sRecipientMail, sSubject, sMsgBody,files)
{
try
{
// create a session and log on -- username and password in profile
var refMsg = WScript.CreateObject("CDO.Message");
var refConf = WScript.CreateObject("CDO.Configuration");
// Setting configuration params
with(refConf.Fields)
{
Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.ru";
Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465;
Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1;
Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "zzz@mail.ru";
Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password";
}
refConf.Fields.Update();
with(refMsg)
{
Configuration = refConf;
To = sRecipientMail;
From = "xxx@mail.ru";
Subject = sSubject;
TextBody = sMsgBody;
}
if (files)
{
for(var i=0; i<files.length; i++)
refMsg.AddAttachment(files[i]);
}
refMsg.Send();
}
catch(e)
{
WScript.Echo("SendMail error !!! : " + e.description);
WScript.Quit(1);
}
}