I'm writing a batch file on Win 2000, and in the middle of it I'd like to launch a Java application that checks some stuff on my system and sends me an email if there's a problem. What's the simplest way to send a no-frills email in the middle of my program? Is it possible? Is there anything available like mailto in Unix? It seems like JavaMail might provide something, but that seems like a big API for writing entire mail applications, and all I want to do is something simple. Please excuse my ignorance about email stuff...
I don't know much about the JavaMail API, but I have worked with the other stuff. You have two options in the Windows world. If this program is running on a machine that has IIS, then your machine has a mail server already installed. To invoke it, you can write a VBScript program that uses the MAPI API. This is the hard way, but it may be one of your limited options if you're running your program on a server that doesn't have MS Office installed on it. The easier way is possible if you do have MS Outlook installed on your machine. Then you can write a fairly simple VBScript program that uses the Outlook object to send e-mails to people. There are dozens of tutorials on how to do this available on the web. I really don't think that there are any sendmail-like, command-line email solutions for Windows unless you're willing to purchase third-party software. It's too bad that MS expects you to be a C++ or VB programmer to do anything even slightly complex on their OS.
Originally posted by Stephen Huey: I'm writing a batch file on Win 2000, and in the middle of it I'd like to launch a Java application that checks some stuff on my system and sends me an email if there's a problem. What's the simplest way to send a no-frills email in the middle of my program?
If you're looking for a solution, you might think about ant. Ant is free available, might be useful for other tasks too, and it would be easy to call ant from your batchfile. Since Ant is written in Java, you could try to implement your own mailcommands and just learn from them.