Home RSS feed

 

Send custom HTML via Gmail from command line

Gmail allows composing and sending of HTML email, but it does not let you edit the source. Among other things, this irritates me because images with links get ugly borders. Luckily, Google also allows us to send emails from your account using other clients. Great, but composing HTML emails with inline/embedded images is still a hassle. Because I couldn't find anything better, I wrote a bash script that converts a webpage/HTML document to an email:

The usage is simple: ./html2email.sh input.html output.txt [subject]

Then output.txt can be mailed by e.g. Gmail. A simple way of doing this is using sendemail:

sendemail -f you@gmail.com -t receiver@hotmail.com -s smtp.gmail.com:587 -o tls=yes -xu you@gmail.com -xp yourpassw -o message-format=raw -o message-file=output.txt

View the script

P.S. Edit output.txt to set To: field.

Tags: bash, shell, script, linux

Created on Wed, 05 Jan 2011 20:35

blog comments powered by Disqus