Gmail 中的 HTML 电子邮件 - 嵌入图像
在 gmail 中嵌入图像的 HTML 邮件 - 具有以下电子邮件正文 - 只是吐出确切的文本。它不显示“body”标签内的内容。
这是邮件的内容:
Content-Type: multipart/related;
boundary="bananarepublic12345"
This is a multipart message in MIME format.
--banana12345republic
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>testing embedded image</title>
</head>
<body bgcolor="#000">
<h1> Testing Embedded Image</h1>
<img src="cid:mambo" alt="ALTERNATE TEXT" >
</body>
</html>
--bananarepublic12345
Content-Type: image/jpeg; name=big-image1.jpg
Content-Transfer-Encoding: base64
Content-ID: <mambo>
Content-Disposition: inline;
filename="big-image1.jpg"
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ...//2Q%3D%3D
我哪里错了?
感谢您的任何建议!
HTML mail with an embedded image in gmail - with the following email body - just spits out the exact text. It does not show what's inside the "body" tags.
This is the content of the mail:
Content-Type: multipart/related;
boundary="bananarepublic12345"
This is a multipart message in MIME format.
--banana12345republic
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>testing embedded image</title>
</head>
<body bgcolor="#000">
<h1> Testing Embedded Image</h1>
<img src="cid:mambo" alt="ALTERNATE TEXT" >
</body>
</html>
--bananarepublic12345
Content-Type: image/jpeg; name=big-image1.jpg
Content-Transfer-Encoding: base64
Content-ID: <mambo>
Content-Disposition: inline;
filename="big-image1.jpg"
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ...//2Q%3D%3D
Where am I going wrong?
Thanks for any suggestion!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已按照问题中的说明进行操作 4018709 并且效果很好。总而言之,您需要将附件的内容 ID 格式化为消息 ID(反过来,将其格式化为电子邮件地址 - 带有 @ 和域),并在 MIME 部分标头中包含内容 ID 值包含在尖括号中的图像(就像您已经做的那样)。
因此,示例电子邮件可能如下所示:
I've followed the instructions in question 4018709 and it worked nicely. To sum it up, you need the content-ids for the attachment to be formatted like message IDs (which in turn are formatted like email addresses - with an @ and a domain), and have the content ID value in the MIME part header of the image enclosed in angle brackets (like you already do).
So a sample email may look like this: