HTML电子邮件正文是否可以引用作为附件发送的文件(在同一电子邮件中)?

问题描述:

HTML电子邮件可以使用图片附件作为标记的来源吗?

Can an HTML email use an image attachment as the source for tag?

假设我正在发送一封电子邮件,其中包含每个电子邮件的特定图片 - 它们作为电子邮件的附件发送 - 电子邮件中的HTML正文可以使用图片?我的猜测是,但是有没有任何 hacks 或解决方法,这将使其工作?

Let's say I am sending an email with per-email specific images - and they are sent as an attachment to the email - can the HTML body within the email use the those images? My guess would be no, but are there any hacks or workarounds that would make it work?

不需要黑客。使用 cid: URI计划

No hacks needed. Use the cid: URI scheme

 --boundary-example 1
 Content-Type: Text/HTML; charset=US-ASCII

 to the other body part, for example through a statement such as:
 <IMG SRC="cid:foo4*foo1@bar.net" ALT="IETF logo">

 --boundary-example-1

 Content-ID: <foo4*foo1@bar.net>
 Content-Type: IMAGE/GIF
 Content-Transfer-Encoding: BASE64

 R0lGODlhGAGgAPEAAP/////ZRaCgoAAAACH+PUNvcHlyaWdodCAoQykgMTk5
 NSBJRVRGLiBVbmF1dGhvcml6ZWQgZHVwbGljYXRpb24gcHJvaGliaXRlZC4A
 etc...

 --boundary-example-1--