Django Contact Form


#1

I have been reading your article at: https://hellowebbooks.com/news/tutorial-setting-up-a-contact-form-with-django/ and everything works as intended but I was wondering if there was a way to include HTML elements within the contact form so when its sent an image can be embedded. I have tried simply adding the HTML element to the content but this doesn’t work.

Grateful for any help you can provide.


#2

Thought I’d quickly clarify, I am specifically interested in embedding images within the body of the email sent from the contact form rather than attaching images to the email.


#3

Hey there!

Sounds like you want to change your emails to send HTML, and in the HTML template you set up, you can add the HTML for the image you want to include.

Here’s a Stack Overflow article that should be helpful: https://stackoverflow.com/questions/3005080/how-to-send-html-email-with-django-with-dynamic-content-in-it

I hope that helps!