Embed attached images in HTML emails
P粉285587590
P粉285587590 2023-08-24 18:08:00
0
2
478
<p>If I attach an image to an email, how do I place it within the HTML content? I tried using just the filename as the image source but that doesn't seem to work. </p>
P粉285587590
P粉285587590

reply all(2)
P粉614840363

The image attachment part requires Content-ID

--T4nu9J8b
Content-Type: image/png
Content-ID: <idname>
Content-Transfer-Encoding: base64
Content-Disposition: attachment ;filename="testimage.png"

iVBORw0KGgoAAAANS...
--T4nu9J8b--

Embed it in the markup using the same Content-ID (without the angle brackets)

<img alt="Embedded Image" src="cid:idname"/>

This should allow additional images to be displayed in HTML!

P粉450079266

More specific instructions on how to build HTML email messages.

The result will be a multipart MIME message containing a text/html part (if you do use an alternative part of type text/plain) and multiple images, which are then referenced from the HTML. p>

See RFC 1813 and RFC 2378 for more information about content-ids and related data (referenced by CIDs in HTML source code) in mixed MIME.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!