问题
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=['jzakaria2000@gmail.com'],
fail_silently=False)
return HttpResponseRedirect('/')
settings.py
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'zetapsiuchicago@gmail.com'
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
回答1:
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 = 'zetapsiuchicago@gmail.com'
EMAIL_HOST_PASSWORD = 'password of zetapsiuchicago@gmail.com in plain text'
来源:https://stackoverflow.com/questions/26153804/smtpsenderrefused-at-submit-contact-form-5-5-1-authentication-required