-2

I set up everything as the Django documentation but when I test sending an email.It works but When I check my inbox I find out that I sent and revived from to the same email address.

Here is the settings.py

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.gmail.com"
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = "myemail@gmail.com"
EMAIL_HOST_PASSWORD = "mypassword" 

And the views.py

...
send_mail( 'subject', 'message', 'user@gmail.com', ['myemail@gmail.com',], fail_silently=False, )
...

But I received an email from myemail@gmail.com to me(myemail@gmail.com).

Rob
  • 14,746
  • 28
  • 47
  • 65
cool mann
  • 21
  • 4

1 Answers1

0

Im not sure if you did this already but if youre using gmail then you will need to do the following.

Sign in to your Google Admin console (Sign in using an administrator account)
Click Security > Less secure apps.
Select Allow users to manage their access to less secure apps.
Click Save.25

Also you should use environment variables for the email address if you are live already eg:

EMAIL_HOST_USER = os.environ.get('MY_EMAIL_USER')
EMAIL_HOST_PASSWORD = os.environ.get('MY_EMAIL_PASS')

If its all working and you are just getting the mail to the wrong address can you send on the document you followed?

In terms of you settings.py that looks fine to me.

Des Cahill
  • 163
  • 2
  • 3
  • 15