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 smtp.gmail.com. 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:
-ssl -smtp smtp.gmail.com -port 587 -id email@example.com -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 firstname.lastname@example.org -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 email@example.com -msg "Hello!" -s "Testing!" -a test.png