If I attach an image to an email, how can I place it in the HTML content? I tried just using the filename as the image source but that doesn't seem to work.
To attach an image, you need to have the encoding scheme of the image you want to attach. This is the base64 string of the picture. You can get this by right-clicking on the image you want to attach, copy the image address, and paste it into the HTML text. The recipient will have a preview of when they open the email.
There are three primary methods for embedding an image into an email: Linking the image, inline embedding, and Content-ID (CID). All three methodologies have pros and cons and require a certain level of expertise to implement, but all are valuable techniques.
Open the email; click “open message”; click “show content” at the top of the message. Click the Mail menu, then click Mail Settings. Click the “Hide images & disable links in mail from unknown senders” box to clear it. Click the “Save” button.
To insert image in an HTML page, use the <img> tags. It is an empty tag, containing only attributes since the closing tag is not required. Just keep in mind that you should use the <img> tag inside <body>… </body> tag.
Be more specific on how you build the HTML mail message.
The result will be a multipart-MIME message with a text/html part (if you really do it right with an alternate part of type text/plain) and several images, which are then referenced from within the HTML.
See RFC 1813 and RFC 2378 for more information about content-id in mixed MIME and related data (referred by CID in the HTML source).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With