A
A
altertable2020-06-15 18:58:22
Django
altertable, 2020-06-15 18:58:22

Django 3 when sending a letter to mail, the images in the letter are not displayed, how to fix it?

subject = name_cinema
html_message = render_to_string('app_template/mail_template.html', context)
plain_message = strip_tags(html_message)
from_email = 'From <[email protected]>'
to = email

mail.send_mail(subject, plain_message, from_email, [to], html_message=html_message)


Layout mail_template.html, a problem with images, with the rest of the content, all the norms
are displayed only option 4, where we indicate a link to the image. {% load static %} connected
<img src="{% static 'img/1234.png' %}" alt="1">
<img src="{% static 'img/1.png' %}" alt="2">
<img src="../../1234.png" alt="3">  
                                                                                                                                                                                                                                  
4<img src="https://www.meme-arsenal.com/memes/579eb482a8540ee55b0bf3db8695a783.jpg" alt="4">

5ee79a9755b50324898133.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tema_sun, 2020-06-15
@vityareabko

What is in STATIC_URL? '/static/'? That won't work. You need to either send images along with the email, or specify the full address in STATIC_URL a la ' https://domain.com/static/ '

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question