Reputation: 1159
I'm trying to send submitted form data to an email address but am getting this error.
Here's my views.py
def contactform(request):
contact_form = ContactForm(data=request.POST)
if contact_form.is_valid():
data = contact_form.cleaned_data
send_mail(subject=data['subject'],
message=data['message'],
from_email=data['email'],
recipient_list=['[email protected]'],
fail_silently=False)
return HttpResponseRedirect('/')
settings.py
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = os.getenv('WEBSITE_PASS')
I've tried googling for solutions to this error, but have so far been unsuccessful. If anyone could help me out with this issue or point me in the right direction, I'd really appreciate it
Upvotes: 1
Views: 2541
Reputation: 490
Adding password in plain text will remove your 5.5.1 Authentication Required Error.
suppose your password is 123weq add it as
EMAIL_HOST_PASSWORD = '123weq'
setting.py
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password of [email protected] in plain text'
Upvotes: 2