当前位置: 首页>>代码示例>>Python>>正文


Python settings.EMAIL_FROM属性代码示例

本文整理汇总了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) 
开发者ID:ScrappyZhang,项目名称:ecommerce_website_development,代码行数:18,代码来源:tasks.py

示例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) 
开发者ID:ScrappyZhang,项目名称:ecommerce_website_development,代码行数:18,代码来源:tasks.py

示例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 
开发者ID:certsocietegenerale,项目名称:FIR,代码行数:32,代码来源:helpers.py

示例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 
开发者ID:certsocietegenerale,项目名称:FIR,代码行数:6,代码来源:email.py

示例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 
开发者ID:enjoy-binbin,项目名称:Django-blog,代码行数:40,代码来源:send_email.py

示例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} 
开发者ID:enjoy-binbin,项目名称:Django-blog,代码行数:36,代码来源:tasks.py

示例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 
开发者ID:xuchaoa,项目名称:CTF_AWD_Platform,代码行数:7,代码来源:tasks.py

示例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) 
开发者ID:xuchaoa,项目名称:CTF_AWD_Platform,代码行数:11,代码来源:Email.py

示例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 
开发者ID:gwu-libraries,项目名称:sfm-ui,代码行数:11,代码来源:notifications.py

示例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 
开发者ID:gwu-libraries,项目名称:sfm-ui,代码行数:12,代码来源:notifications.py

示例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 
开发者ID:gwu-libraries,项目名称:sfm-ui,代码行数:10,代码来源:notifications.py


注:本文中的django.conf.settings.EMAIL_FROM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。