Search the Community
Showing results for tags 'task scheduler email'.
Found 1 result
Hi All - I believe there was another thread on this issue, but to keep things simple, I wanted to start a new one. If this is in poor taste, I do apologize, here goes. What the script does: Looks to a txt files that has a list of computer. Goes line by line and pings each machine. If it does not ping back, it emails me with the machine in the subject line. That's it. The script works perfectly, when running manually (through explorer). I get msgbox confirmations and the emails send. However, when running the same script through task scheduler, it will not send the email and no msgboxes appear. I am not as concerned with the msgboxes, as I am with just ensuring that the emails work. The smtp server does not require any authentication and is internal. Any ideas?? I appreciate any help that can be given. Thank you in advance. Code below and attatched: #include <Inet.au3> #include <MsgBoxConstants.au3> $file = FileOpen("checks.txt" , 0) While 1 $answer = FileReadLine($file) If @error Then Exitloop local $ping1 = Ping($answer, 4000) If $PING1 = 0 Then Local $s_SmtpServer = "smtp.xxxxx.com" Local $s_FromName = @computername Local $s_FromAddress = @computername Local $s_ToAddress = "firstname.lastname@example.org" Local $s_Subject = ""& $answer &" DOWN" Local $as_Body $as_Body = "" Local $iResponse = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @computername, -1) Local $iErr = @error $Username = "" ; password for the account used from where the mail gets sent - REQUIRED $Password = "" ; port used for sending the mail $IPPort = 25 ; enables/disables secure socket layer sending - put to 1 if using httpS $ssl = 0 If $iResponse = 1 Then MsgBox($MB_SYSTEMMODAL, "Success!", "Mail sent") Else MsgBox($MB_SYSTEMMODAL, "Error!", "Mail failed with error code " & $iErr) EndIf ;MsgBox(0, "Status", ""& $answer &" Offline",3) else ;MsgBox(0, "Status", ""& $answer &" Online",3) EndIf Wend FileClose($file) checks - forum.au3