Skip to content
Advertisement

How to send an email to currently logged in user Django

I am currently trying to set up a view so when the user visits the path /clip it will send an email to the user’s inbox.

Eg. I visit path, email turns up in my inbox.

I am using this:

JavaScript

I’m using 3.0.4 and get this error when I visit the path:

JavaScript

Can anyone help? Thanks

EDIT: I have used the answer by reza heydari and it fixes this issue, now I get the following:

JavaScript
JavaScript

is there any way I can set it up so it just sends the email using the SMTP settings in settings.py?

Advertisement

Answer

The 3rd arg of send_mail is from_email based on docs Change your code like that:

JavaScript

And also add

JavaScript

For your local to recieve email in terminal

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement