Send Email via Gmail from Command Prompt

Gmail can be used for sending mail by any mail program and from any network.

Some command-line mail products for Windows are:

SendEmail
mailsend
(I have no first-hand experience with these products.)

See also this article : How to use Gmail as your SMTP server.


Blat:

What is Blat?
Blat is a Win32 command line utility that sends eMail using SMTP or post to usenet using NNTP.


HowToGeek demonstrates a Windows PowerShell script that works very well at How To Send Email From the Command Line in Windows Without Extra Software

Here is the method: First you're defining the variables:

$EmailFrom = “[email protected]
$EmailTo = “theRecipient'[email protected]
$Subject = “your subject”
$Body = “some text”
$SMTPServer = “smtp.gmail.com”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“yourGmailUsername”, “password”);

Then, you're using this command to send the mail:

$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

You'll need a valid Gmail account in order to authenticate as a Gmail user.