I have tried every combination of search on Google I can think of to find a simple tutorial on how to embed an image into an email with the Mime Mail module. There are a number of tutorials that show how to do add attachments but nothing on images in the email body.

Does anyone know of such a tutorial? or have you also failed to make this work?

If it does support this functionality could the developers provided an example of how to use it. I have read the readme.txt file and know that relative URLs are required. I have tried this, but still a link is created and Yes I have also removed the check from the "Use Links Only" option in configuration.

The body of my html looks like this

<html>
<head></head>
<body>
<img src='/var/www/vhosts/arduino-mega.com/simoncarr.co.uk/priv_files/1/Theo_face.jpg'>
</body>
</html>

The image in Gmail comes through with the following source.

https://ci4.googleusercontent.com/proxy/R586YOSDlSMEK3ei9yrxzd6ywNAv8Uy2QfiuBLkJ1TCjROnTP0TPi9AnVwchn1HsepQEKGHIYjzn-o5fmWb9nc6BtdvWdaBUSGflO6KIvUr9NDpj_UpJlctBFIxxSnjZMG1NAzJF_w=s0-d-e1-ft#http://var/www/vhosts/arduino-mega.com/simoncarr.co.uk/priv_files/1/Theo_face.jpg

I have a requirement to use the private file system so linking images is not an option.

Comments

simonjcarr’s picture

Issue summary: View changes
simonjcarr’s picture

Issue summary: View changes
rjacobs’s picture

We had problems with this as well... as the process is far from obvious.

Note that it seems you must host your file in a standard public Drupal files directory for everything to run as expected (like sites/default/files). I did not dissect the code, but I assume the modules uses some Drupal api calls when fetching the file stream which enforce permissions checks (public/private files, etc.). We found that even if the file is placed in a publicly accessible place it won't work unless that location is inside sites/default/files. Once we moved the file accordingly, and ensured our template used a path relative to the site root (sites/default/files/myimage.jpg... just like specifying the path to an internal "shipped file") things started working and the image was properly embedded.

Maybe that helps in your case as well?

mglaman’s picture

Confirmed in #3. I've spent the past week figuring out why images weren't embedded. When referencing images in my theme folder (using absolute URL, because relative provided an empty body and email failed to send) I would receive...

PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9uYWwv L0VOIiAiaHR0cDovL3d3dy53My5vcmcvVFIvUkVDLWh0bWw0MC9sb29zZS5kdGQiPgo8aHRtbCBz dHlsZT0iLW1vei1ib3gtc2l6aW5nOmJvcmRlci1ib3g7LXdlYmtpdC1ib3gtc2l6aW5nOmJvcmRl ci1ib3g7Ym94LXNpemluZzpib3JkZXItYm94O3ZlcnRpY2FsLWFsaWduOmJhc2VsaW5lOyI+

But moving the images into sites/default/files/* I was able to embed images successfully.

Example:
<td class="email-header"><img src="https://www.justcamo.com/sites/default/files/email/email-header.jpg" alt="Just Camo - Living the Outdoors"/></td>

sgabe’s picture

Component: Code » Documentation
Category: Bug report » Task
Status: Active » Closed (fixed)

I have added a note about this in the README.txt.