Sending emails from commandline

Sending emails from commandline

Pretty easy but annoying task. Especially when you want to send email using specific SMTP server, or from GMAIL using SSL or add some attachment, or send RAW emails. Solution is there – mailsend . Extremely simple command line tool for Linux, Mac OS X and even Windows ;). Compile / download binary and you can enjoy freedom of sending emails from command line.

Sample usage:

send email  with attachment and copy to given address:

mailsend -smtp localhost -t email@example.com -f test@otheraddress.com -attach attachment.zip -name from_name -M "bodycopy"

let’s send email RAW email using GMAIL account:

mailsend -starttls -auth -smtp smtp.gmail.com -user myuser@gmail.com -pass mypass -t destintation@email.com -f myuser@gmail.com -attach test.zip,application/zip,a -name me -msg-body test.txt -sub email with attachment

Send email using Amazon SES

mailsend -starttls -auth -smtp email-smtp.us-east-1.amazonaws.com -user KEY -pass PASS -t to@email.address -name me -f confimed@email.address -sub test -M "message"