socket.gaierror: [Errno 11001] getaddrinfo failed

前端 未结 8 1985
北海茫月
北海茫月 2021-01-06 08:33

I have tried to attached a file to the mail using python. Code:

import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIME         


        
8条回答
  •  清歌不尽
    2021-01-06 08:59

    you might did a little mistake in settings.py file.. check your code one more time in your settings file settings.py:

    EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
    EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_HOST_USER = 'your_email'
    EMAIL_HOST_PASSWORD = 'your_password'
    EMAIL_PORT = 587
    EMAIL_USE_TLS=True
    

提交回复
热议问题