在电子邮件正文中发送html文件的输出 [英] Send the output of html file within the email body

查看:221
本文介绍了在电子邮件正文中发送html文件的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在/tmp folder下有一个HTML文件,作为chart.html file,当您打开html file

I have an html file under /tmp folder as chart.html file which will have the output like below image when you open that html file

我有一个Shell脚本,用于将chart.html文件作为附件发送到带有一些正文消息的电子邮件中.

I have a shell script that I am using to send the chart.html file as an attachment in an email with some body message.

问题陈述:-

是否可以在电子邮件正文中发送html文件的彩色图像(当您打开它时)?这样人们就可以在该电子邮件正文中看到此图像,而不用打开附件文件.下面是我用来在带有正文消息的电子邮件中发送附件的命令-

Is is possible to send this colorful image of the html file(when you open it) within the body of an email? So that people can see this image in there email body, instead of opening the attachment file. Below is the command that I am using to send the attachment in an email with body message-

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

我需要在上面的命令中进行哪些更改才能在体内发送这张彩色图像.

What changes I need to make in my above command to send this colorful image within the body itself.

推荐答案

在21世纪包含图像的正确方法是使用MIME.您的信息基本上应该是

The proper way to include an image in the 21st century is with MIME. Your message should basically be something like

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作为图像;然后,许多客户将在文字下方显示图片.

You can also try with a text/plain text part and a Content-Disposition: inline for the image; many clients will then display the image below the text.

当然,如果您已经将所有内容都保存在一个HTML文件中(如何处理图像?),则只需将其附加到像mutt这样的现代MUA上,都可以通过简单的命令行来完成.

Of course, if you already have it all in one HTML file (how? with the image?) then just attaching that with a modern MUA like mutt should all be doable with a simple command line.

这篇关于在电子邮件正文中发送html文件的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆