1

Okay so following is my email template:

<html>

<head>
{% load staticfiles %}

</head>

<body>

<h2>Welcome!</h2>
<img src = "{% static 'app/images/logo1.png' %}" style = "position: absolute; left: 5%; height: 100%; width:50%;" />


<div style = "position: absolute; top: 100%; left: 0%; height: 10%; width: 100%: color: #006699;"></div>

<img src = "{% static 'app/images/content.png' %}" style = "position: absolute; left:0%; top: 110%; height: 100%; width: 60%">
</img>
</body>

</html>

Following is my email function:

        html_template = render_to_string('email_template.html', {})

        try:
            send_mail(
                'Title',
                'Plaintext Version Goes Here',
                'sender',
                [email],
                html_message=html_template,
            )
        except:
            return HttpResponse("No!")

When I send the mail only Welcome! is printed in the mail. The images do not show up. Any idea why?

Thanks in advance!

rishran
  • 596
  • 2
  • 7
  • 26

1 Answers1

2

I resolved this specified the full STATIC_URL, e.g http://localhost:8000/static/ and when deployed, i changed to the domain. Try to change it to

<img src = "http://localhost:8000/static/app/images/logo1.png" style = "position: absolute; left: 5%; height: 100%; width:50%;" />

I have found this possible other solution but i don't tried.

Community
  • 1
  • 1
Paulo Pessoa
  • 2,509
  • 19
  • 30