How to Send Email From Windows Command Line With Attachment

Email remains one of the most powerful tools for both personal and professional communication. Beyond staying in touch with friends and family, it’s essential for real-time notifications and alerts. Whether you need to know when your server goes down via a monitoring service like Pingdom or require automated status updates from third-party backup software, email notifications keep you informed at every step.

If you’re writing a batch file and want to automatically send an email upon completion—or using a third-party tool that lacks built-in email alerts—a command-line email-sending tool for Windows is your go-to solution. This guide explores seven robust utilities that simplify sending emails via the command line.


How to Use These Tools

Each tool example below uses a sample command line for sending an email through Gmail. Before running any commands, update these parameters accordingly:

  • [email protected] – Replace with your full Gmail address
  • [email protected] – Replace with the recipient’s email address
  • YourGmailPassword – Replace with your Gmail password
  • subject – The email subject (use double quotes if it contains spaces, e.g., "This is a long subject")
  • message – The email body (also use double quotes if it contains spaces)

1. SwithMail

Among command-line email tools, SwithMail stands out due to its intuitive configuration GUI, minimizing errors in command syntax. You can even test your email settings directly before execution.

SwithMail configuration settings

SwithMail supports attachments, CC, BCC, wildcard attachments for log files, and error code returns.

Command example for sending an email via Gmail:

shCopyEditSwithMail.exe /s /from [email protected] /pass YourGmailPassword /server smtp.gmail.com /p 587 /SSL /to [email protected] /sub subject /b message

Download SwithMail


2. CMail

If proxy support is essential (SOCKS or HTTPS-based proxies), CMail is a great choice. It also supports wildcard attachments and delivery status notifications.

Gmail command example:

shCopyEditCMail.exe -secureport -host:[email protected]:[email protected]:465 -from:[email protected] -to:[email protected] -subject:subject -body:message

Download CMail


3. SendSMTP

SendSMTP offers both an interactive GUI and a powerful command-line tool. Beginners can configure it via GUI, while advanced users benefit from direct command-line execution.

SendSMTP interface

Gmail command example:

shCopyEditSendSMTP.exe /nos /host smtp.gmail.com /port 587 /auth 2 /userid [email protected] /pass YourGmailPassword /from [email protected] /to [email protected] /subject subject /body message

Download SendSMTP


4. mailsend

mailsend is a simple SMTP command-line tool for Windows and Linux. While it lacks a GUI or encryption features, it provides a useful -info option to display SMTP server details.

mailsend SMTP info

Gmail command example:

shCopyEditmailsend1.17b15.exe -t [email protected] -f [email protected] -ssl -port 465 -auth -smtp smtp.gmail.com -sub subject -M message -user [email protected] -pass YourGmailPassword

Download mailsend


5. Send-It-Quiet

Send-It-Quiet is a lightweight SMTP mailer (14KB) built on the .NET Framework. It supports custom registry parameters and return values via ERRORLEVEL.

Gmail command example:

shCopyEditsenditquiet.exe -s smtp.gmail.com -port 587 -u [email protected] -protocol ssl -p YourGmailPassword -f [email protected] -t [email protected] -subject subject -body message

Download Send-It-Quiet


6. SendEmail

Despite its last update in 2009, SendEmail still supports TLS for Gmail SMTP and doesn’t require Perl installation on Windows.

Gmail command example:

shCopyEditsendEmail.exe -o tls=yes -f [email protected] -t [email protected] -s smtp.gmail.com:587 -xu [email protected] -xp YourGmailPassword -u subject -m message

Download SendEmail


7. PowerShell

Windows PowerShell provides a built-in way to send emails via Gmail SMTP without third-party tools.

PowerShell send email script

Run the PowerShell script:

shCopyEditPowershell.exe -executionpolicy remotesigned -File C:\Users\Raymond\sendemail.ps1

Final Notes

Older tools such as Blat lack SSL support and are omitted from this list. Tools like Bmail and XmlSendmail are outdated and do not support Gmail SMTP authentication.

By choosing the right command-line email tool for your needs, you can easily automate email notifications for various tasks—whether for monitoring servers, sending logs, or integrating alerts into scripts.

31 Comments - Write a Comment

  1. SteveHolland 4 years ago
  2. Rakesh Dadhich 4 years ago
  3. Stans 4 years ago
  4. Terry Bogayong 5 years ago
    • Humphrey 4 years ago
  5. Maik 5 years ago
    • Justin Goldberg 4 years ago
  6. damien 5 years ago
  7. rich 5 years ago
    • HAL9000 5 years ago
  8. Nico den Breejen 5 years ago
    • Humphrey 5 years ago
  9. Karthick N 5 years ago
    • Humphrey 5 years ago
  10. Yuri Kalashtov 6 years ago
    • Humphrey 6 years ago
  11. Tim Hodgson 6 years ago
  12. Barry Milburn 6 years ago
  13. Humphrey 9 years ago
  14. john 9 years ago
    • Sundowner 9 years ago
  15. ack1970 9 years ago
  16. Mauro 9 years ago
  17. German Martinez 9 years ago
    • Borg 9 years ago
  18. Borg 9 years ago
  19. erickesau 9 years ago
  20. Tony4219 10 years ago
  21. Medical blog 15 years ago
  22. joseph r 15 years ago
  23. zuarxpdc 15 years ago

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please contact us directly.