django構成163 qqメールボックス送信メール
2778 ワード
163メールボックスの構成
qqメールボックスの設定
#
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.163.com'
EMAIL_PORT = 25
#
EMAIL_HOST_USER = '*******@163.com'
#
EMAIL_HOST_PASSWORD = '******'
#
EMAIL_FROM = 'python' #
qqメールボックスの設定
# qq
EMAIL_HOST = 'smtp.qq.com'
EMAIL_HOST_USER = '*******@qq.com'
EMAIL_HOST_PASSWORD = '*********'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_FROM = '********@qq.com'
from django.core.mail import send_mail
from django.conf import settings
def send_email_demo(request):
from_who = settings.EMAIL_FROM #
to_who = '******@163.com' #
subject = ' ' #
#
message = ' ' # message
# meg_html = 'クリックジャンプ' # html
send_mail(subject, message, from_who, [to_who], html_message=meg_html)
return HttpResponse("ok")
"""
: send_mail
def send_mail(subject, message, from_email, recipient_list,
fail_silently=False, auth_user=None, auth_password=None,
connection=None, html_message=None):
"""