mailx를 사용하여 이메일 본문에 HTML 파일 출력 보내기

mailx를 사용하여 이메일 본문에 HTML 파일 출력 보내기

문제 설명:-

mailx현재 이메일에 html 파일을 첨부하여 이메일을 보내고 있습니다. 하지만 명령을 사용하여 이메일을 보내고 이메일에 추가하는 대신 이메일 본문에 결과를 표시 mailx하고 싶습니다 .html filehtml file

다음은 이메일 본문과 attaching chart.html file이메일의 일부 내용이 포함된 이메일을 보내는 데 사용하는 스크립트입니다. instead of attaching html file내가 보여주고 싶은 이메일 에 output of html file within an email body다음 스크립트의 예와 이를 달성하려면 어떤 변경이 필요한지 보여줄 수 있습니까?

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

이것이 chart.html file제가 그린 차트이므로 이메일 본문에 차트를 표시해야 합니다.

<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>

어떤 도움이라도 대단히 감사하겠습니다. 나는 뛰고있어SunOS

bash-3.00$ uname -a
SunOS lvsaishdc3in0001 5.10 Generic_142901-02 i86pc i386 i86pc

답변1

문자/일반 이메일로는 이 작업을 수행할 수 없습니다. 이 HTML은 수신 이메일 클라이언트 소프트웨어가 JavaScript를 지원하는 경우에만 이메일 메시지에 직접 포함될 수 있습니다. 나는 이런 일을 하는 사람을 모릅니다.

기본적으로 두 가지 옵션이 있습니다. 첫 번째는 그리기 소프트웨어가 HTML 이메일에 포함될 수 있는 이미지 파일을 생성하도록 하는 것입니다. 이미지는 이메일에 포함된 위치에 표시됩니다. 두 번째 방법은 HTML 이메일에 차트를 표시하는 링크를 포함하는 것입니다. 실제 콘텐츠를 얻으려면 브라우저를 열어야 할 수도 있습니다.

첫 번째 옵션을 사용하려면 첫 번째 유형 과 두 번째 유형의 Content-Type: multipart/related type="multipart/alternative"두 부분 이상을 포함하는 구조화된 이메일을 사용해야 합니다 . "이미지 포함" 섹션을 참조하세요.text/htmlimage/<whatevertypeyourimageis>페이지이를 수행하는 방법에 대한 추가 정보.

두 번째 옵션에는 두 가지 접근 방식이 있습니다. 첫 번째 접근 방식은 URL에 인코딩된 데이터를 받아들이고 이에 따라 페이지를 렌더링하는 일반 페이지를 구축하는 것입니다. 두 번째는 각 데이터세트에 대해 고유한 페이지를 구축하는 것입니다.

관련 정보