1

Is there a free command-line-based, lightweight SMTP server for Windows?

All I'm looking for is the ability to send HTML emails from the command-line, using a standalone EXE, with the program being its own server (rather than using some other server like Gmail).

By "lightweight" I mean there should be a single executable, or -- if not possible -- it should come with at most a handful of supporting DLLs, and run standalone (i.e. without installing anything).

Specifically:

  • I am not looking for hMailServer. It may be awesome, but it's still bloated for sending a single email. I just need a command-line tool I can have handy on a flash drive or a recovery environment -- something that does not require installation.

  • The server needs to support TLS -- i.e., it should be able to send mail to major providers like Gmail, which require encryption.

  • IIS fails every test: it's (1) not lightweight and (2) not standalone.


For those who claim Gmail doesn't need encryption:

$ telnet smtp.gmail.com 25
Trying 209.85.225.108...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP a9sm264065ibi.26
HELO
250 mx.google.com at your service
MAIL FROM: [email protected]
530 5.7.0 Must issue a STARTTLS command first. a9sm264065ibi.26

What am I doing wrong?

14
  • GMail doesn't require TLS or any type of encryption for SMTP. (I just confirmed this by making a raw connection with PuTTY on TCP port 25 and manually sent a message to myself without only four commands, none of which involved any encryption.) Aug 17, 2011 at 4:32
  • @Randolf: What were the commands? Each time I tried, it told me I have to use TLS...
    – user541686
    Aug 17, 2011 at 4:38
  • Standard SMTP commands -- HELO, MAIL FROM, RCPT TO, DATA (QUIT is outside of that because a successful return code following a properly completed DATA command is all that's required to send a message; using QUIT to end the session is still important though). Aug 17, 2011 at 4:50
  • 1
    @Randolph: :O OMG, it worked! So it was an issue with the server... interesting, thanks a lot for the info. But how do you figure out which server you need to connect to, when all you have is the email address the user gives you? Is there a way to look it up with DNS or something? Thanks!
    – user541686
    Aug 17, 2011 at 6:25
  • 1
    @Randolph: Interesting, thanks a lot for the info; that's really helpful! (BTW, my emails went to spam, lol...)
    – user541686
    Aug 17, 2011 at 6:50

1 Answer 1

2

I use Blat to send mails from the command line and have also used this in programs to send mail as well. It is a single executable.

enter image description here

5
  • I just tried it with blat Email.txt -to [email protected] -server smtp.gmail.com -f my_email and I got Blat v2.6.2 w/GSS encryption (build : Feb 25 2007 12:06:19) Sending Email.txt to [email protected] Login name is my_email The SMTP server does not like the sender name. Have you set your mail address correctly?
    – user541686
    Aug 17, 2011 at 4:43
  • Right, gmail needs SSL. For this I use another light program called stunnel stunnel.org You set up stunnel to run on a local port, say 2099, and then tell blat to send to 127.0.0.1:2099 Not pretty, but still lightweight and it works. I even used this stunnel trick to get Sharepoint to send to gmail accounts. Good luck! Aug 17, 2011 at 4:50
  • The only problem with "blat" is that it doesn't perform its own DNS lookups for MX records -- you have to specify the server. +1 because this is a good solution otherwise though (and there are dozens of alternatives, all of which don't seem to perform their own MX record lookups). Aug 17, 2011 at 4:52
  • Is this a server? "What is Blat (and what does it do)? blat.net/?faq/index.html#what_is_blat_(and_what_does_it_do) "What is Blat (and what does it do)? Blat is a small, efficent SMTP command line mailer for Windows. It is the SMTP sending part of an eMail User Agent (MUA) or eMail client. As such, Blat sends eMail via SMTP (or internet eMail) from the command line, or CGI, ..." <-- looks like not a server.
    – barlop
    Sep 15, 2014 at 16:56
  • And regarding the -install option. from the same page blat.net/?faq/index.html#cl__why_should_i_run_blat_install... "CL - Why should I run Blat -install...? Because it simplifies the command line by storing any or all of the following in the registry SMTP Server Address Sender's Address " <-- So looks like that option doesn't make it a server.
    – barlop
    Sep 15, 2014 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .