Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Windows 2003 R2 server and I want to send an email from the command line. This server does not have the SMTP service configured. Is there a one liner that will let me send an email? My specific use case at the moment is to send an email when a performance alert is triggered, but it would be useful in general.

I'm hoping for something like

foomail -t -f -m "Alert!  the sky is falling"

Update: I would much prefer a solution that does not involve installing 3rd party software.

share|improve this question
Utilities like blat and sendemail don't require installation. They're both freestanding exe files. – John Gardeniers Feb 5 '10 at 22:26
I guess I have to accept that I need to at the very least copy an exe (either blat or powershell) to each machine. If that's the case, then blat is very easy to use. Thanks. I still wonder why MS left this feature out, considering how many other less useful ones they put in to the standard distro. – Peter Feb 8 '10 at 17:55
up vote 15 down vote accepted

I'd try blat. You could write a vbscript but there is no built in executable to send mail

share|improve this answer
seconding blat. It can be a bit picky about passing parameters directly from the command line, but once you nail it, does exactly what the OP needs. – Chris Thorpe Feb 5 '10 at 23:51
I've been using blat for years with great success. However, If I was writing in powershell, I'd switch. – uSlackr Feb 8 '10 at 19:29
Does blat able to work as send mail path for PHP on Windows? – sємsєм Aug 14 '14 at 22:02

Would you consider powershell rather than cmd.exe? If so, sending mail is built in:

$SmtpClient = New-Object System.Net.Mail.SmtpClient
$SmtpServer = ""
$ = $SmtpServer 

$From = "Me <>"
$To =
$Title = "Subject"
$Body = "Body Text" 

To make a one liner, save the following to a powershell script file (sendmail.ps1):

        [string] $From = "",
        [string] $To = "",
        [string] $Title = "title",
        [string] $Body = "body"
    $SmtpClient = New-Object System.Net.Mail.SmtpClient
    $SmtpServer = ""
    $ = $SmtpServer 

(make sure to change the smtpserver to be your real one)

Then you can call it using:

powershell.exe c:\path\to\sendmail.ps1 "" "" "title" "body"
share|improve this answer
powershell would also have to be installed, otherwise I would have prefered it over vbscript. – Jim B Feb 5 '10 at 23:48
Nice answer. Just one minor change, the arguments need to be single quotes. – Brain2000 Jan 21 '15 at 23:45

I've used bmail with great success in the past.

Usage (copied from website)

C:\>bmail /?

    Command Line SMTP Emailer V1.07
    Copyright(C) 2002-2004
    Usage: bmail [options]
            -s    SMTP Server Name
            -p    SMTP Port Number (optional, defaults to 25)
            -t    To: Address
            -f    From: Address
            -b    Text Body of Message (optional)
            -h    Generate Headers
            -a    Subject (optional)
            -m    Filename (optional) Use file as Body of Message
                -c    Prefix above file with CR/LF to separate body from header
                -d    Debug (Show all mail server communications)
share|improve this answer
I have to admit, I was hoping for a built in solution, though Jim's answer seems to imply that was a bit naive of me... – Peter Feb 5 '10 at 18:49

Try free Mail Alert Simple Mailer:

It supports SSL/TLS mail servers like gmail and its' easy to configure.

share|improve this answer
It supports SSL too. – Roland Pihlakas Jul 17 at 17:19

One more command-line mailer program:

It supports SSL too.

share|improve this answer

blat is a really simple solution. Works for me on Windows SBS 2011. Here is what I used to send daily report about the server harddisk status:

blat status.txt -to -subject "HP Server Status" -server -f -u -pw mypassword


status.txt - body of an email message

-f - "from", sender's address

-u - user for SMTP authentication (our ISP's SMTP server requires authentication)

-pw - password for SMTP authentication

share|improve this answer
blat has already been suggested (and is the accepted answer). – Gerald Schneider Aug 18 '15 at 13:46

Your Answer


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.