本文整理匯總了Python中django.conf.settings.EMAIL_FROM屬性的典型用法代碼示例。如果您正苦於以下問題:Python settings.EMAIL_FROM屬性的具體用法?Python settings.EMAIL_FROM怎麽用?Python settings.EMAIL_FROM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類django.conf.settings
的用法示例。
在下文中一共展示了settings.EMAIL_FROM屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: send_register_active_email
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def send_register_active_email(to_email, username, token):
"""發送激活郵件"""
# 組織郵件內容
subject = '天天生鮮歡迎信息'
message = ''
sender = settings.EMAIL_FROM
receiver = [to_email]
html_message = """
<h1>%s, 歡迎您成為天天生鮮注冊會員</h1>
請點擊以下鏈接激活您的賬戶(7個小時內有效)<br/>
<a href="http://127.0.0.1:8000/user/active/%s">http://127.0.0.1:8000/user/active/%s</a>
""" % (username, token, token)
# 發送激活郵件
# send_mail(subject=郵件標題, message=郵件正文,from_email=發件人, recipient_list=收件人列表)
send_mail(subject, message, sender, receiver, html_message=html_message)
示例2: send_register_active_email
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def send_register_active_email(to_email, username, token):
"""發送激活郵件"""
# 組織郵件內容
subject = '天天生鮮歡迎信息'
message = ''
sender = settings.EMAIL_FROM
receiver = [to_email]
html_message = """
<h1>%s, 歡迎您成為天天生鮮注冊會員</h1>
請點擊以下鏈接激活您的賬戶<br/>
<a href="http://127.0.0.1:8000/user/active/%s">http://127.0.0.1:8000/user/active/%s</a>
""" % (username, token, token)
# 發送激活郵件
# send_mail(subject=郵件標題, message=郵件正文,from_email=發件人, recipient_list=收件人列表)
send_mail(subject, message, sender, receiver, html_message=html_message)
示例3: prepare_email_message
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def prepare_email_message(to, subject, body, behalf=None, cc=None, bcc=None, request=None):
reply_to = {}
if hasattr(settings, 'REPLY_TO'):
reply_to = {'Reply-To': settings.REPLY_TO, 'Return-Path': settings.REPLY_TO}
if behalf is None and hasattr(settings, 'EMAIL_FROM'):
behalf = settings.EMAIL_FROM
if not isinstance(to, (tuple, list)):
to = to.split(';')
email_message = EmailMultiAlternatives(
subject=subject,
body=body,
from_email=behalf,
to=to,
cc=cc,
bcc=bcc,
headers=reply_to
)
email_message.attach_alternative(markdown2.markdown(
body,
extras=["link-patterns", "tables", "code-friendly"],
link_patterns=registry.link_patterns(request),
safe_mode=True
),
'text/html')
return email_message
示例4: __init__
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def __init__(self):
super(EmailMethod, self).__init__()
if hasattr(settings, 'EMAIL_FROM') and settings.EMAIL_FROM is not None:
self.server_configured = True
示例5: send_email
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def send_email(email, send_type='register'):
"""
發送郵件的方法
register: 注冊賬號
forget: 找回密碼
change: 修改郵箱
"""
if send_type == 'register':
subject = '彬彬博客注冊激活鏈接'
code_str = generate_random_str(16)
message = '請點擊下麵的鏈接激活您的賬號: http://127.0.0.1:8000/active/{0}'.format(code_str)
elif send_type == 'forget':
subject = '彬彬博客忘記密碼連接'
code_str = generate_random_str(8)
timestamp = int(time.time())
md5 = hashlib.md5()
md5_str = md5.update((code_str + email + str(timestamp)).encode('utf8'))
hash_str = md5.hexdigest()
message = '請點擊下麵的鏈接修改你的密碼: http://127.0.0.1:8000/reset?timestamp={0}&hash={1}&email={2}'.format(timestamp,
hash_str, email)
elif send_type == 'change':
subject = '彬彬博客修改郵箱連接'
code_str = generate_random_str(6)
message = '你的郵箱驗證碼為: {0}'.format(code_str)
else:
return False
status = send_mail(subject, message, settings.EMAIL_FROM, [email])
if status: # 發送成功
email_code = EmailVerifyCode()
email_code.email = email
email_code.code = code_str
email_code.type = send_type
email_code.save()
return True
else:
return False
示例6: send_email_task
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def send_email_task(email, code_str, send_type):
"""
使用celery異步發送郵件
@email 郵件收件方
@code_str 郵件驗證碼
@send_type: 郵件類型
"""
if send_type == 'register':
subject = '彬彬博客注冊激活鏈接'
message = '請點擊下麵的鏈接激活您的賬號: http://127.0.0.1:8000/active/{0}'.format(code_str)
elif send_type == 'forget':
subject = '彬彬博客忘記密碼連接'
timestamp = int(time.time())
md5 = hashlib.md5()
md5_str = md5.update((code_str + email + str(timestamp)).encode('utf8'))
hash_str = md5.hexdigest()
message = '請點擊下麵的鏈接修改你的密碼: http://127.0.0.1:8000/reset?timestamp={0}&hash={1}&email={2}'.format(timestamp,
hash_str, email)
elif send_type == 'change':
subject = '彬彬博客修改郵箱連接'
message = '你的郵箱驗證碼為: {0}'.format(code_str)
else:
logger.error('非法的發送類型'.format(email))
return {'status': 'fail', 'error': 'illegal send_type'}
status = send_mail(subject, message, settings.EMAIL_FROM, [email]) # ,html_message=
if status:
logger.info('{0}郵件發送成功'.format(email))
return {'status': 'success', 'email': email}
else:
logger.error('{0}郵件發送失敗'.format(email))
return {'status': 'fail', 'email': email}
示例7: SendMail
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def SendMail(code,recipient_list):
message = '【SDUTCTF】 歡迎注冊SDUTCTF平台,您的驗證碼為:{} ,驗證碼有效時間為五分鍾。'.format(code)
status = send_mail('注冊SDUTCTF', '', settings.EMAIL_FROM, recipient_list, html_message=message)
return status
示例8: SendMail
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def SendMail(code,recipient_list):
message = '【SDUTCTF】 歡迎注冊SDUTCTF平台,您的驗證碼為:{} ,驗證碼有效時間為五分鍾。'.format(code)
status = send_mail('注冊SDUTCTF', '', settings.EMAIL_FROM, recipient_list, html_message=message)
return status
# send_list = ['755563428@qq.com']
# SendMail(send_list)
示例9: _create_space_email
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def _create_space_email(email_address, msg_cache):
text_template = get_template('email/free_space_email.txt')
html_template = get_template('email/free_space_email.html')
msg_cache["url"] = _create_url(reverse('home'))
d = msg_cache
msg = EmailMultiAlternatives("[WARNING] Low free space on SFM server",
text_template.render(d), settings.EMAIL_FROM, [email_address])
msg.attach_alternative(html_template.render(d), "text/html")
return msg
示例10: _create_queue_warn_email
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def _create_queue_warn_email(email_address, msg_cache):
text_template = get_template('email/queue_length_email.txt')
html_template = get_template('email/queue_length_email.html')
msg_cache["url"] = _create_url(reverse('home'))
msg_cache["monitor_url"] = _create_url(reverse('monitor'))
d = msg_cache
msg = EmailMultiAlternatives("[WARNING] Long message queue on SFM server",
text_template.render(d), settings.EMAIL_FROM, [email_address])
msg.attach_alternative(html_template.render(d), "text/html")
return msg
示例11: _create_email
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import EMAIL_FROM [as 別名]
def _create_email(user, collection_set_cache):
text_template = get_template('email/user_harvest_email.txt')
html_template = get_template('email/user_harvest_email.html')
d = _create_context(user, collection_set_cache)
msg = EmailMultiAlternatives("Update on your Social Feed Manager harvests", text_template.render(d),
settings.EMAIL_FROM, [user.email])
msg.attach_alternative(html_template.render(d), "text/html")
return msg