簡體   English   中英

在電子郵件正文中發送html文件的輸出

[英]Send the output of html file within the email body

我在/tmp folder下有一個html文件作為chart.html file ,當你打開那個html file時,它會有如下圖所示的輸出

在此輸入圖像描述

我有一個shell腳本,我用來將chart.html文件作為附件發送到帶有一些正文消息的電子郵件中。

問題陳述:-

是否可以在電子郵件正文中發送html文件的這個彩色圖像(當你打開它時)? 這樣人們就可以在電子郵件正文中看到這個圖像,而不是打開附件文件。 以下是我用於在帶有正文消息的電子郵件中發送附件的命令 -

mailx -s "LIP Data Quality Report for $DATE_YEST_FORMAT1" -r rj@host.com rj@host.com <<EOF
Data Successfully loaded into LIP_DATA_QUALITY table

Total Items Purchased: `echo $QUERY1 | awk '{print $1}'`

Total Items MissingorMismatch: `echo $QUERY1 | awk '{print $2}'`

Error Percentage: $QUERY2

$(uuencode /tmp/chart.html percentage_graph.html)

EOF

我需要在上面的命令中做出什么改變才能在身體內發送這個彩色圖像。

在21世紀包含圖像的正確方法是使用MIME。 你的信息基本上應該是這樣的

From: you <you@example.net>
To: recipient <victim@example.com>
Subject: well, say something
Mime-Version: 1.0
Content-type: multipart/related; boundary=foo

Often you have something about this being a MIME message here.

--foo
Content-type: text/html; charset=utf-8
Content-transfer-encoding: us-ascii

<html><yada yada><img src="cid:bar"></html>

--foo
Content-type: image/png
Content-id: bar
Content-transfer-encoding: base64

sdflkjsdflkjsdflkjsdflkjsdflksdfl=

--foo--

您還可以嘗試使用text/plain文本部分和Content-Disposition: inline圖像; 然后,許多客戶將在文本下方顯示圖像。

當然,如果你已經將它全部放在一個HTML文件中(如何使用圖像?),那么只需將它與像mutt一樣的現代MUA附加,應該只需要一個簡單的命令行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM