smtp

Django send_mail through gmail very slow

匆匆过客 提交于 2020-08-27 05:49:10
问题 When I try send through ./manage.py shell it takes several minutes to send a single email. When I try to send a user verification email after a form submission in a browser the browser times out with a 504, but the email is eventually sent. What could be going on? settings.py ... EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'myemail@gmail.com' EMAIL_PORT = 587 EMAIL_USE_TLS = True DEFAULT_FROM_EMAIL = EMAIL_HOST_USER EMAIL_HOST_PASSWORD = os.environ.get('PASSWORD') ... views.py class

Can anyone tell my why I'm getting the error [AttributeError: 'list' object has no attribute 'encode']

拜拜、爱过 提交于 2020-08-22 09:57:10
问题 I keep trying to run this code in order to send an excel sheet as an attachment on an email. I can send normal emails using smtplib but can't get the MIMEMultipart to work. I keep getting the [AttributeError: 'list' object has no attribute 'encode'] error import smtplib, ssl from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email.mime.text import MIMEText from email import encoders fromaddr = ['Email'] sendto = ['Email'] msg = MIMEMultipart() msg['From']