I’m trying to send an HTML formatted email from Linux Command line. Previously, I use mailx to send the email, but it’s only allow us to send plain text email. Luckily, I came across to ‘sendmail’. After testing couple of time, I’m finally able to send HTML formatted email. The code as follow:
(cat <<EOCAT
Subject: Title of the email
MIME-Version: 1.0
Content-Type: text/html
Content-Disposition: inline
EOCAT
cat htmlfile.html) | sendmail toemail@hollyghozi.com
As you see in my code above, there’re two parts of the email that I combine into one and send using ‘sendmail’.
- Header: the first ‘cat’
- Body: the second ‘cat’ is reading ordinary HTML file
and both redirect to sendmail that will send an HTML to recipient.
Bash: Send HTML Email from Linux Command Line
May 14th, 2009
6 Comments
-
Brett
-
Rupeni
-
markinsonmarshal
-
markinsonmarshal
-
Frobroj
-
http://www.bspmedia.fi Pauli Tuominen






