Monthly Archives: August 2007

Send mail from the command line

Ever need to send a one-line email from a DOS/CMD batch file? If your PC or Server has .Net 2 installed you can use this application.

It’s straightforward. Place the cmdSendmail.exe in your path or working directory and then type something like this at the command line:-

cmdSendMail you@emailtest.com~you@somewherelse.com~The Subject~The main text of the message~you@somewherelse.com~pass123~mail.somewherelse.com

Usage

cmdSemdMail {command string delimited by tilde}

To send an email create a single string with all the paramters of your message. Use the tilde (~) to delimit the paramters of your email.

cmdSendMail Download

Two ways to call a URL from a batch

Sometimes it’s useful to extract a web page to a file from a Windows batch.

For example I have a batch file that downloads financial figures every day, processes them and updates a database.

vbcurl http://myfinancialfigures.com/something.php >mydatafile.htm

If you don’t have a copy of Opera handy use a statement like the following to read the source from a page that blocks right click:-

vbcurl http://annoyingwebsitesthat.com/blockrightclicks.php >secret_source.htm

Vbcurl