posted on Monday, January 17, 2005 12:58 PM
by
johnwood
Free SendMail Utility for Windows
Download a beta of FreeSendMail here.
I spent a little while looking around for a command-line mail send utility, something like Unix's SendMail. But all I found were products that would cost me $20 or more! Maybe I didn't look hard enough, but like many I make the assumption that if things aren't on the first 2 pages of Google then they effectively don't exist or at least aren't any good.
The thing is, .Net gives you everything you need to send email, in an SmtpMail class. To send mail from the command line, I just had to expose this class - and how difficult could that be?! It had to be another 10 minuter.
So once again I did it myself. To save others the hassle of searching through google, or paying cash, I've compiled it into a simple command-line utility and put it up on my website.
When you run it you get:
Free SendMail v0.1 Beta, (c) J. Wood Software Services LLC
usage: sendmail /s mailServer /f from /t to /m filename /j "subject" [/h(tml)]
Sure it's nothing fancy, but it appears to get the job done from the limited testing I've run.
Here's an example of how you might use it:
sendmail /s mymailserver.com /f "John Wood <john.wood@mail.com>" /t "Bill Goats <billg@murkysoft.com>" /j "invoice 205123" /m mailbody.txt /h
If /H is specified, then the contents of the file should contain HTML text, otherwise it should contain plan text.
Download it and let me know what bugs you find.
Addendum: Since posting this I was reminded of the open source Blat utility (http://www.blat.net/194/) which offers far more features. But hey, if you like simple with C# source...