Page 1 of 1 1
Topic Options
#65161 - 2002-05-02 06:27 PM Send E-mail from server (without me being logged on!!!)
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
#65162 - 2002-05-03 06:14 AM Re: Send E-mail from server (without me being logged on!!!)
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Kellar,

POSTIE can be found here - http://www.infradig.com/infradig/postie/index.shtml

If you don't want to purchase a Command-line e-mailer, you will want to look into BLAT and is available from - http://www.interlog.com/~tcharron/blat.html

HTH,

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#65163 - 2002-05-03 06:30 AM Re: Send E-mail from server (without me being logged on!!!)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Do you have an SMTP server in the same subnet? Some admins won't let you bounce SMTP from other subnets. Can you bounce SMTP from say, an IIS server?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65164 - 2002-05-03 07:46 PM Re: Send E-mail from server (without me being logged on!!!)
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
#65165 - 2002-05-03 08:09 PM Re: Send E-mail from server (without me being logged on!!!)
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Kellar,
It's my turn for my ignorance of Exchange to be exposed. I am also ignorant of Postie. I would assume it uses SMTP. We use Lotus Notes. I use SMTP to send mail from web forms on my intranet as well as from several of my NMS (Network Management Systems) apps like WhatsUP, UPS, and environment monitors. In our case, as long as I am within the same "A" class IP, I can bounce email off of our SMTP server. From another class, I cannot. This, I understand is a 'best practice' since your SMTP would be exposed to the internet and you would not want spammers bouncing mail off your server.

I thought if you had another resource like an intranet server to run some tests on, it would confirm whether your email admin is blocking you. Can you not work with your email admin to get you the functionality you need?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#65166 - 2002-05-03 10:47 PM Re: Send E-mail from server (without me being logged on!!!)
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 [Confused]

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
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1057 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.052 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org