haezeban
asked on
DOS bat-file mail via Java
Hi,
I need to make a dos bat-file to shedule.
In this bat-file I call sqlplus to run a query that works fine.
The results of that query needs to be mailed to an address.
On the same machine I found an example of an old college. In his bat-file the last instruction is :
java -cp .;D:\BR\com\util\activatio n.jar;D:\B R\com\util \mail.jar com.util.CheckFile "D:\BR\LOG\UL3.bad" "mailadres@mail.du" "SQLLOADER" "111.x.111.xx" "Results of query
In the directory where I found his bat-file there is a diretory com\util with the files activation.jar, mail.jar and CheckFile.Class.
I copied this to my directory but it seems not to work (when executing the bat-file I receive an error on that mailing) . I have no experience with java at all.
I think that I may not copy the jar-file. But I need to install something? Also the Checkfile.Class I think I have to change this, but how can I do this. (With notepad it is rubbish)
Can someone give me a hint how I can solve this.
Thanks
I need to make a dos bat-file to shedule.
In this bat-file I call sqlplus to run a query that works fine.
The results of that query needs to be mailed to an address.
On the same machine I found an example of an old college. In his bat-file the last instruction is :
java -cp .;D:\BR\com\util\activatio
In the directory where I found his bat-file there is a diretory com\util with the files activation.jar, mail.jar and CheckFile.Class.
I copied this to my directory but it seems not to work (when executing the bat-file I receive an error on that mailing) . I have no experience with java at all.
I think that I may not copy the jar-file. But I need to install something? Also the Checkfile.Class I think I have to change this, but how can I do this. (With notepad it is rubbish)
Can someone give me a hint how I can solve this.
Thanks
ASKER
IIS doesn't run on that machine. I don't see it in administrative tools and not under services.
I don'think I can se your script.
anyway thanks
I don'think I can se your script.
anyway thanks
For commandline send mail, it's best to use BLAT (www.blat.net). It allows for many options including sending attachments, and needs nothing installed on the executing PC.
try this:
Set objEmail = CreateObject("CDO.Message" )
objEmail.From = "fromaddress@from.com"
objEmail.To = "toaddress@to.com"
objEmail.Subject = "subjkect"
objEmail.Textbody = "message"
objEmail.Send
If you have any MAPI client on the computer, it should work by using those settings.
Set objEmail = CreateObject("CDO.Message"
objEmail.From = "fromaddress@from.com"
objEmail.To = "toaddress@to.com"
objEmail.Subject = "subjkect"
objEmail.Textbody = "message"
objEmail.Send
If you have any MAPI client on the computer, it should work by using those settings.
ASKER
Hi,
I wrote a routine in C# and don't use anymore this javamail.
Thanks for help.
I wrote a routine in C# and don't use anymore this javamail.
Thanks for help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@echo off & setlocal
:: set the temp file location
set tempmail=%temp%\tempmail.%
:: echo the basic headers to the temp file
echo To: "Scripting Test" ^<test@paulsadowski.com^> > %tempmail%
echo From: "Me" ^<me@my.com^> >> %tempmail%
echo Subject: Test2 >> %tempmail%
:: echo the blank line that separates the header from the body text
echo.>>%tempmail%
:: echo the body text to the temp file
echo First line of body text.>> %tempmail%
echo Second line of body text.>> %tempmail%
:: move the temp file to the mail pickup directory
:: adjust this location for your system
move %tempmail% c:\inetpub\mailroot\pickup
set tempmail=
endlocal