Problem Statement:-
Currently I am sending an email using mailx by attaching an html file within the email. But I want to send an email using mailx command instead of attaching the html file in an email, I want to show the results of html file within an email body.
Below is the script I am using to send an email with some content in the body of an email and attaching chart.html file in an email. And instead of attaching html file in an email, I want to show the output of html file within an email body. Can anyone show me an example basis on my below script what changes I need to make to accomplish this?
mailx -s "LIP for $DATE_YEST_FORMAT1" -r [email protected] [email protected] <<EOF
Total Items Purchased: `echo $QUERY1 | awk '{print $1}'`
Total Items Missingo: `echo $QUERY1 | awk '{print $2}'`
Error Percentage: $QUERY2
`uuencode /tmp/chart.html chart.html`
EOF
And this is my chart.html file which draws a graph- So I need to show this graph within the email body.
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Title');
data.addColumn('number', 'Value');
data.addRows([
['No Error Percentage', $NOERROR],
['Error Percentage', $ERROR]
]);
// Set chart options
var options = {'title':'LIP Data Quality Report',
'width':700,
'height':600};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<div id="chart_div" style="width:900px; height: 800px;"></div>
</body>
</html>
Any help will be appreciated. And I am running SunOS
bash-3.00$ uname -a
SunOS lvsaishdc3in0001 5.10 Generic_142901-02 i86pc i386 i86pc