With heirloom-mailx, you can change the sendmail program to your hook script, replace the headers there, and then use sendmail.
script I use ( ~/bin/sendmail-hook ):
#!/bin/bash sed '1,/^$/{ s,^\(Content-Type: \).*$,\1text/html; charset=utf-8,g s,^\(Content-Transfer-Encoding: \).*$,\18bit,g }' | sendmail $@
This script changes the values ββin the mail header as follows:
Content-Type: to text/html; charset=utf-8 text/html; charset=utf-8Content-Transfer-Encoding: up to 8bit (not sure if this is really necessary).
To send an HTML email address:
mail -Ssendmail='~/bin/sendmail-hook' \ -s "Built notification" address@example.com < /var/www/report.csv
loentar Sep 17 '14 at 7:01 2014-09-17 07:01
source share