Send GMail From the Windows Command-Line with MailWrench

Originally published on: Sun, 13 Feb 2011.

Google’s GMail service allows e-mail to be sent using an SMTPS ( SMTP over SSL ) interface. Sending GMail via the Windows command-line requires a command-line mailer with SMTPS support. My commercial MailWrench utility is one such program.

Update 25 July, 2012: MailWrench is now free, open source software. Please see the post at the following link:

The GMail SMTPS service listens at port 587 on the server To configure MailWrench to send mail using GMail, create a text file that we’ll just name m.cfg and add the following configuration lines:

-port 587
-password your_password

The MailWrench command-line you would then use to send a simple message would be something like the following:

MailWrench @m.cfg -to some_id@someserver.kom -msg "Hello!" -s "Testing!"

Note that any of the options specified in the file m.cfg could have been specified on the command-line itself. The “.cfg” files are intended to be used to contain options that rarely change when sending e-mails.

Since GMail does not allow arbitrary attachments, any file you attach must be one of the permissible attachment types ( word-processor documents, spreadsheets, images,audio, …etc. ) Your e-mail may not process properly if you send other file types.

To attach the image file test.png to the above e-mail, add the parameters -a test.png to the above command-line. The new command-line should look like the folllowing:

MailWrench @m.cfg -to some_id@someserver.kom -msg "Hello!" -s "Testing!" -a test.png

About Jim Lawless

I've been programming computers for about 36 years ... 30 of that professionally. I've been a teacher, I've worked as a consultant, and have written articles here and there for publications like Dr. Dobbs Journal, The C/C++ Users Journal, Nuts and Volts, and others.
This entry was posted in Programming and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s