SMTPSenderRefused at /submit_contact_form/ - 5.5.1 Authentication Required

久未见 提交于 2020-01-05 05:19:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!