我已經創建了一個Django應用程序發送電子郵件與Outlook帳戶。到目前爲止,它在本地工作,但我無法使其在線工作。我應該改變EMAIL_PORT
中的某些內容還是添加其他內容?發送電子郵件在Django當地工作,但不在線
這是我的設置文件:
EMAIL_HOST = 'smtp-mail.outlook.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'xxx'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
這是我的看法文件:
t = loader.get_template('email2.html')
c= Context({'customer':customer,})
try:
send_mail('Thanks for your order', t.render(c) , '[email protected]',[email], fail_silently=False)
except:
# add not sent to my DB
提前非常感謝。
確保正確的設置正在加載到您的「在線」環境中。如果本地工作,則不應更改「EMAIL_PORT」。 –