awk - How to attach multiple html files in Email body from unix -
i trying generate , send html files attaching email body. tried using awk generating , sending 1 file. eg. input file martini has these records:
1554894,2015-04-16,00:21:52,processes.martini_gsicorptradeeventoutput.instancecount,0,1,up 1554793,2015-04-15,22:03:52,processes.martini_gsicorptradeeventoutput.instancecount,2,0,down
and have awk in file named html:
awk 'begin { fs="," print "mime-version: 1.0" print "to:lijo@abc.com" print "from:lijo@abc.com" print "subject: health check" print "content-type: text/html" print "content-disposition: inline" print "<html>""<table border="1"><th>ref_id</th><th>eod</th><th>time</th><th>process</th><th>desc</th><th>instance</th><th>status</th>" } { printf "`<tr>`" for(i=1;i<=nf;i++) printf "`<td>%s</td>`", $i print "`</tr>`" } end { print "`</table></body></html>`" } ' /home/martini > /home/martini_html
later send file through email cat martini_html | /usr/sbin/sendmail -t
. works until here. have 2 new tasks how convert multiple files martini1, martini2 ... etc html files , how attach them in email body separate table block , not single table. assuming 2 files attached email body should similar image attached.
here's how it: cheat.
send email 2 attachments. use raw email template. way can skip discovery mime types , whatnot.
Comments
Post a Comment