bash - How to send a html file using mails in shell script? -
i want store matrix's data in html file , send email in outlook ,my code looks follows:
printf "<!doctype html>" printf "<html>" printf "<head>" printf "<style>" printf "</style>" printf "</head>" printf "<body>" printf "<table>" printf "<tr>" printf "<th>total</th>" printf "<th>stillfail</th>" printf "<th>pass</th>" printf "<th>scripterror</th>" printf "<th>apiname</th>" printf "</tr>" printf "<tr>" echo ((j=1;j<=num_rows;j++)) printf "<tr>" ((i=1;i<=num_columns;i++)) printf "<td>" printf "${matrix[$j,$i]}" printf "</td>" printf "</tr>" done echo done printf "</tr>" printf "</table>" printf "</body>" printf "</html>" #mailx -a 'content-type: html' -s "my subject" tapariak@amazon.com < output.html mailx -s "testing mail"</home/tapariak/keshav/output.html "tapariak@amazon.com"
out put corresponding code looks follows:
i want output aligned table. can me on this? tia
you need append content-type in header can done -a flag in mailx
comment last line , try
mailx -a 'content-type: text/html' -s "test mail" tapariak@amazon.com</home/tapariak/keshav/output.html
edit :
as per op end error :
content-type:texthtml no such file or directory
to install mailutils
in mac
press command+space , type terminal , press enter/return key. run in terminal app: ruby -e "$(curl -fssl https://raw.githubusercontent.com/homebrew/install/master/install)" < /dev/null 2> /dev/null , press enter/return key. wait command finish. run: brew install mailutils
reference : http://macappstore.org/mailutils/
Comments
Post a Comment