Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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: my_email@gmail.com
530 5.7.0 Must issue a STARTTLS command first. a9sm264065ibi.26

What am I doing wrong?

share|improve this question
    
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.) –  Randolf Richardson Aug 17 '11 at 4:32
    
@Randolf: What were the commands? Each time I tried, it told me I have to use TLS... –  Mehrdad Aug 17 '11 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). –  Randolf Richardson Aug 17 '11 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! –  Mehrdad Aug 17 '11 at 6:25
1  
@Randolph: Interesting, thanks a lot for the info; that's really helpful! (BTW, my emails went to spam, lol...) –  Mehrdad Aug 17 '11 at 6:50
show 7 more comments

1 Answer

up vote 2 down vote accepted

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

share|improve this answer
    
I just tried it with blat Email.txt -to my_email@gmail.com -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 my_email@gmail.com Login name is my_email The SMTP server does not like the sender name. Have you set your mail address correctly? –  Mehrdad Aug 17 '11 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! –  Daniel Williams Aug 17 '11 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). –  Randolf Richardson Aug 17 '11 at 4:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.