Send e-mails from the command prompt
Sep 5th, 2008 by admin
clmail.exe
This is a small command line utility that will send a plain text e-mail. There is nothing fancy about it – you can’t attach any files, you can’t have html formatting, you can’t send CC or BCC. Neither can you add reminders, flag for importance, request receipt or any other fancy stuff like you can do from MS Outlook.
You can specify the sender’s address, the receiver’s address, the mail server, the subject of the e-mail, and the message itself.
There are some restrictions as well. You can not start any word in either subject or message with a slash. In other words, this message is not allowed: You can find it in the /binary directory. You can, however, use it inside a word, which means that URL are fine: http://www.kmyhre.com
(Technically, the reason is simple. Any occurances of a space followed by a slash, is interpreted as a switch. See list of switches below.)
So, what’s the point of such a simple program? Basically, it is for scripting. I wanted an easy way to send e-mails, without having to use VBscript. I just wanted the possibility to send a message by e-mail when certain events occured.
Note: It requires Microsoft .NET Framework v2.0
(The framework is free, and available for download. Most likely it is already installed on your computer.)
Mandatory switches are:
/from <sender’s e-mail address>
/to <receiver’s e-mail address>
/smtp <smtp server address>
/subject <your subject goes here>
/message <you message goes here>
Optional switches are:
/quiet (will not display “send successfull” message”)
/debug (will display how it interprets all the command line arguments.)
(it will still try to send the e-mail!)
Feel free to leave any comments, feature requests, bug reports etc. below.
Can’t get this to work, do you have to be an adminstrator?
Does is matter if your smtp server requiers authentication?
Is this tested on Win 7?
If the smtp server requires authentication, it will not work, as this application doesn’t support sending username and password. I thought I had tested it on Vista, but maybe I’ve only tested it on XP. Thus I’m not sure if administrator priveleges are required. I have not tested it on Windows 7.
I’ll have a look at it when I’m back from vacation.
Sorry, I completely forgot to answer this comment. I’ve just tried this on WIndows 7, and it works like a charm.
Keep in mind that some smtp-servers require that you enter a valid from address, or at least you current from domain.
Also, note that to run, it requires Microsoft .NET Framework v2.0 to be installed.