Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to include HTML code in Mailx mail body

Tags:

unix

How can i send the email using mailx command including the HTML code? for example:

mailx -s "Report" << EOF
Report Generated
<table width="600">
<tr><td width="30%">&nbsp;&nbsp;</td><td width="35%" style="font-size:7pt;">Definition</td></tr></table>EOF

however the mail did send, but which is not as html code..

Anybody know how to send mailx including the html inside the mail body?

like image 254
sean Avatar asked Oct 19 '10 08:10

sean


1 Answers

I havent used mailx for sending HTML but have used sendmail. You can use the following if you can use sendmail instead of mailx

(echo -e "Subject: $SUBJECT\nMIME-Version: 1.0\nFrom: $MAIL_FROM\nTo:$MAIL_TO\nContent-Type: text/html\nContent-Disposition: inline\n\n";/bin/cat $MAIL_FILE) | /usr/sbin/sendmail -f  $MAIL_FROM $MAIL_TO

I tried this on Linux

like image 168
Raghuram Avatar answered Oct 12 '22 05:10

Raghuram