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 addressYourGmailPassword– Replace with your Gmail passwordsubject– 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 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
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
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.

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
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.

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
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
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
7. PowerShell
Windows PowerShell provides a built-in way to send emails via Gmail SMTP without third-party tools.

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.

User forum
31 messages