how to include HTML code in Mailx mail body
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%"> </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?
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
mailx allows you to specify additional headers with the -a option.
So you can use something as mailx -a "Content-Type: text/html"
.
the -a "Content-Type..." works with mailx on Ubuntu.
精彩评论