I have created a function the would send mail to a particular user when redirected to a particular url. It was working until today. However, today when it gets redirected to the url, the email is displayed in the terminal and not in the inbox of reciever. I am attaching the mail function and settings in the code.
views.py
def mail(request,pk):
pr = UserProfile.objects.get(pk=pk)
subject = "Greetings"
msg = "Congratulations for your success"
to = 'urvi0728@gmail.com'
res = send_mail(subject, msg, settings.EMAIL_HOST_USER, [to])
if(res == 1):
msg = "Mail Sent Successfuly"
else:
msg = "Mail could not be sent"
return HttpResponse(msg)
settings.py
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '*****@gmail.com'
EMAIL_HOST_PASSWORD = '*********'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'