1. 程式人生 > >django發送郵件配置

django發送郵件配置

tty end ash 用戶 .com con keyword settings 我們

    • 配置如下,settings中配置:
    EMAIL_HOST = ‘smtp.163.com‘
    EMAIL_PORT = ‘25‘
    EMAIL_HOST_USER = [email protected]
    EMAIL_HOST_PASSWORD = ‘******‘   # 填密碼
    • 然後調用send_mail發送郵件即可
            subject = u‘號碼通激活‘
            print name
            message = u‘用戶:‘ + name + u‘ 您好,首先非常感謝你的註冊‘                  + u"\n點擊鏈接就可以激活郵箱,從而用郵箱進行登陸:"                   + u"http://192.168.1.163:8080/account/activate/?activation_key=" + activation_key                  + u"\n我們將為你提供非常好的號碼相關服務:比如號碼備份/群組建立/號碼查找/群組活動等等,來自108網絡教研室"
    
            print message
            send_mail(subject, message, settings.EMAIL_HOST_USER, [dst_email])

django發送郵件配置