|
First off, my thanks to the board for helping me write this script which has greatly helped me do what I am looking to do:
**************************************************
; set date variable $m=@month $d=@mdayno $b=$m+$d
; get WAN backup log $sFilename="\\yeg01-nts-02\backup\wan\logs\wanbackup\" + $b + ".log" $fText=val("&"+olecallfunc(olecreateobject("Scripting.FileSystemObject"), "OpenTextFile", "s", $sFilename)) $xText = olecallfunc($fText, "ReadAll") $=olecallfunc($fText, "Close")
; get LAN backup log $sFilename="\\yeg01-nts-02\backup\wan\logs\lanbackup\" + $b + ".log" $fText=val("&"+olecallfunc(olecreateobject("Scripting.FileSystemObject"), "OpenTextFile", "s", $sFilename)) $sText = olecallfunc($fText, "ReadAll") $=olecallfunc($fText, "Close")
; send mail $recipient= "canada - information services" ; dl list for users $subject= "Backup Report for @date" $message= "The following is an automated backup report for backups running previous to 6:00 a.m. MST, @date."+chr(10)+chr(10)+"--------------------------------------"+$sText+chr(10)+chr(10)+"--------------------------------------"+$xText $outlook= olecreateobject("outlook.application") $namespace= val("&"+olecallfunc($outlook, "getnamespace", "s", "MAPI")) $= olecallfunc($namespace, "logon") $mailitem= val("&"+olecallfunc($outlook, "createitem", "s", "0")) $recipients= val("&"+olegetproperty($mailitem,"recipients")) $= olecallfunc($recipients,"add","s","$recipient") $= oleputproperty($mailitem, "subject", "s", "$subject") $= oleputproperty($mailitem, "body", "s", "$message") $= olecallfunc($mailitem, "send") $= olecallfunc($namespace, "logoff" ) $= olereleaseobject($recipients) $= olereleaseobject($mailitem) $= olereleaseobject($outlook) quit **************************************************
I use this OLE script to read some logfiles created from our backup process. It places the text from the logfiles into an e-mail and sends it out to a distribution list.
I run this script from my workstation with the windows task scheduler and it works like a charm.
The Problem: I have to be logged in for this script to work. I don't know how to send this from a server without a user logged on that has an associated e-mail account (NT/Exchange environment).
I want to send this from a server somehow where I can specify the username to the exchange server in the script. Additionally, I cannot figure out how to change the from field in the e-mail the recipients recieve. I want it to appear as though someone else (i.e. "Backup Admin") is sending the e-mail. This is minor though.
Now in attempts to work this out, I have looked at postie.exe closely because it is supposed to work well in an exchange environment and came up with this:
************************************************** shell "cmd /c postie.exe -host:10.47.152.41 -port:25 -from:kdyjur@@ikon.com -to:kdyjur@@ikon.com -s:YOU Rock and Roll... -msg:test" **************************************************
It runs, but no message appears. I have also looked at mapisend after reading some posts on this board. I can find all the documentation in the world on this and it sounds good, but I can't find this little executable for free anywhere on the net! I'm not buying the exchange resource kit expecially because I am not the mail admin for our network.
Can anyone help me with the OLE script, or post postie scripts that worked for you? I am hoping that postie can work, but am leary that the exchange admin is filtering against this.
|