Image inside of a template is not showing even when the full URL path is hardcoded

Hello,

  • I’m trying to display an image (which is saved in my mediafiles folder which in turn is found at the root folder of my project) inside of a template that is sent as an email.
  • But for some reason in the email the image does not get displayed even when the full URL path is set as the value of the src attribute of the img element.
  • However, when you use the full URL path of an image from a random site that image will be displayed in the email.
  • I’m running the project on my local computer.
  • The image will be uploaded by a user when they register their account.

This is the template where I have placed the full URL path of the image found in my mediafiles folder:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <h1>This is a heading</h1>
    <img src="http://localhost:8000/mediafiles/imresizer-1728264009179_mILhWic.jpg" 
  style="width: 60px; height: 60px; border-radius: 50%; margin-right: 10px;" />
  </body>
</html>

This is the template where I have placed the full URL path of an image I found online:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <h1>This is a heading</h1>
    <img src="https://cloudfour.com/examples/img-currentsrc/images/kitten-large.png" style="width: 60px; height: 60px; border-radius: 50%; margin-right: 10px;" />
  </body>
</html>

Comparison of emails (the one on top is the result of using the URL of my image and the one on the bottom is the result of using the URL of the random sample image I found online):

Any help is much appreciated !

And I just wanted to show that the image is present at the URL path:

Welcome @kristofferbaker !

How are you accessing these emails? (What email client are you using?)

I’m guessing that the problem is an issue with your email client trying to access a URL identified as localhost.

Monitor your server instance when you open the email to see if the email client is even making a request to the server. If you don’t see a request being made, then the issue is with the email client.

Hi Ken,
Thank you for helping me.
I was accessing them through Gmail.
And indeed, I observed that the server was not receiving a request whenever I opened the email.
I also experienced the problem when I tried to use a different email client (Proton). In Proton it stated that it blocked the request maybe due to the URL using http.
I will try again once I have implemented https.

Thank you again for the help,
Kris