#65161 - 2002-05-02 06:27 PM
Send E-mail from server (without me being logged on!!!)
|
Anonymous
Anonymous
Unregistered
|
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.
|
|
Top
|
|
|
|
#65164 - 2002-05-03 07:46 PM
Re: Send E-mail from server (without me being logged on!!!)
|
Anonymous
Anonymous
Unregistered
|
Thanks for the links Kent!
Les, I do not have a SMTP server on my subnet, it is located across a WAN link. Is Exchange SMTP based (my ignorance exposed).
|
|
Top
|
|
|
|
#65166 - 2002-05-03 10:47 PM
Re: Send E-mail from server (without me being logged on!!!)
|
Anonymous
Anonymous
Unregistered
|
Unfortunately, there is very little collaboration between our team and the exchange admins. It is partly due to geography (us in Canada, and them in Southern USA). Almost everything is assesed for security risks; I asked him for the mapisend tool and he did not reply
Left to my own devices, and no real knowledge of Exchange, I'm afraid I cannot figure this one out. I'll just have to find that mapisend I guess.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1058 anonymous users online.
|
|
|