SendEmail is a free command line email utility that lets you send email from command line. SendEmail lets you attach files while sending an email, send HTML Content or send email as a text, specify the CC and BCC for the email, provide the input from the STDIN (Standard Input), operate in verbose or quite mode. You can also add custom Email Headers, specify Charset and the message format. This command line email utility automatically detects HTML content as well. SendEmail is also available for Linux, OS X and BSD.
SendEmail is an excellent command line email utility if you are looking for a tool to send emails from command line. This would let you schedule emails to be sent out and can be used with other tools that generate reports.
This command line email utility does not have a Graphical User Interface. This makes a very lightweight tool that would not take time to load those huge libraries and eat up memory space. Moreover this gets the job done quickly.
Using SendEmail – Command Line Email Utility
We will use the command prompt to provide it with the information that it needs.
This is how we get to the command prompt:
Press the Windows Key and “R” Key. This should bring up the “Run” Box where you can type the name of the program or file you want to open. Now we would type “cmd” to open the command prompt. We don’t stop you from accessing the Command Prompt from the Start Menu and typing “cmd” into the “Search Bar” or getting to it by navigating to it: Start Menu -> Programs -> Accessories -> Command Prompt.
As we got to the command prompt, we can change the current directory to the folder (directory) where “SendEmail” utility resides. This is how we do it:
Once we’re in the directory where our command line email utility resides, we can start using it. We will discuss some of the important parameters (also called Arguments) to get started.
We need to provide the SMTP (Simple Mail Transfer Protocol) server’s address. We connect to the SMTP server of our email service provider to send emails using it.
Parameter would look like this: -s smtp.gmail.com. Here -s is the specifies that we’re going to provide the server’s address. If you’re SMTP server requires you to connect to it at a specific port then use it like this:
To and From Address
To specify the To address: -t email@example.com
To specify the From Address: -f firstname.lastname@example.org
To specify the subject of the email: -u “The Subject”
CC and BCC
You can specify the CC (Carbon Copy) and BCC (Blind Carbon Copy) by using the ‘-cc’ for CC. To specify the BCC, you can use ‘-bcc’. You can separate multiple address with commas.
Ex: -cc email@example.com, firstname.lastname@example.org -bcc email@example.com
To specify the message body: -m “The message you want to send to the receiver.”
You can also include messages with multiple lines like this: -m “This is a test mail sent with SendEmail\nThis is line two”
The ‘\n’ will break the line and will start a new line of text.
You can also import the body of the email from a file. It can be a simple text file or an HTML file as well. This command line email utility automatically detects HTML content and tells the server that it’s an HTML Message. To import the message from a file, we use ‘-o message-file=FILENAME’
Ex: -o message-file=”C:\Users\ILFS01\Desktop\MyMessages\CustomMess1.txt”
What if you don’t want to import the message and want to be more spontaneous and type the message on the go. You can set SendEmail to read the message as you type it. You can simple provide just the ‘-m’ option. SendEmail will assume that you want to type the input in. You can terminate the input by pressing CTRL+Z, whenever you feel full.
You might want to attach a file while sending an email. You can do attach a file to your email by using the ‘-a’.
Example: -a Data1.txt Data2.txt Data3.pdf
Username and Password
You would need the username and password for the SMTP server to verify you and allow you to use the server.
To specify the username: -xu myusername
To specify the password: -xp mypassword
Putting it all together:
sendemail -s smtp.gmail.com -xu myusername -xp mypassword -f firstname.lastname@example.org -t email@example.com -u "Test Mail" -m "Hi Ed\nThis is a test mail. Check out the attachment too." -a mynewcarpic.jpg myfamily.jpg
Silence v/s The Scream
You can either tell this command line email utility to become more expressive and dump all what it feels, to the screen or tell it to operate in a stealth mode in which it doesn’t tell you anything what it’s doing.
Verbose Mode: sendemail -s smtp.gmail.com -xu myusername -xp mypassword -f firstname.lastname@example.org -t email@example.com -u “Test Mail” -m “Don’t Freak out! Happy Halloween” -a ScaryMaskPic.jpg -v
Quite Mode: sendemail -s smtp.gmail.com -xu myusername -xp mypassword -f firstname.lastname@example.org -t email@example.com -u “Test Mail” -m “I am an Undercover agent and I have sent this mail to 10,000 people. So don’t tell anyone who I am ;)” -q
Dump it all to the Log
While you’re using the Verbose mode, you might get tempted to dump the output to a log file. Don’t stop yourself and use the ‘-l’ option.
Ex: -l logfile.txt
SendEmail is a magnificent command prompt email software that lets you do so much just from the command line. This tool could be your first choice when you want to setup an automated environment where you get email for everything that happens in your computer. You could achieve this by using it with other tools that can dump output to a file. Whether it be a simple looking email or a good looking HTML email you want to send, this command line email utility has it all. You could schedule the task and automate the task of sending emails. Try this out and experience a new way of sending email.