I am working on a project that uses Django email backend and I receive an email in the terminal every time an email is sent. Right now, the whole email in the terminal is showing in one line irrespective of where I used different <p>
tags. I want to know, is there's a way I can preview emails the same way they would be sent to the users?
Asked
Active
Viewed 106 times
0

Soumya Sharma
- 9
- 4
-
Are you using `django.core.mail.backends.console.EmailBackend`? – alissongranemann Jan 15 '20 at 22:12
-
Yes. I am receiving mails in the terminal but they are in a single line and I am not able to check if the receiver will receiver mails with proper indentation, spacings, changed paragraphs or font colours. – Soumya Sharma Jan 16 '20 at 10:39
1 Answers
0
An email is Html code, so you can either load it in a browser,(I am assuming you are using Linux), For running from the terminal you do something like
google-chrome <filename>.html
or if you want to see it in terminal itself then you can a terminal browser like Lyx
lynx <filename>
The Lynx browser is not that great but it will allow you at least basics, like 'br' and 'p'.
If you want Django to do it, simply create a view function and the browser will take care of the rest.

Harsh Nagarkar
- 697
- 7
- 23
-
In my project, I receive emails in the terminal whenever I comment, so the mails have some email variables like `{{ comment }}`, `{{ user }}`. Your method is giving an error stating 'this site can't be reached'. – Soumya Sharma Jan 16 '20 at 10:45
-
I think your email is coming in as terminal output, so you can either save the email to a file or pipe it into the above commands to view it. If it doesn't work would be more specific as to where the problem is occuring? – Harsh Nagarkar Jan 16 '20 at 18:52