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


Python Message.html方法代码示例

本文整理汇总了Python中pyramid_mailer.message.Message.html方法的典型用法代码示例。如果您正苦于以下问题:Python Message.html方法的具体用法?Python Message.html怎么用?Python Message.html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid_mailer.message.Message的用法示例。


在下文中一共展示了Message.html方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: confirmation

# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import html [as 别名]
def confirmation(request):
    '''
    Generates confirmation page and confirmation emails to user and D2L site 
    admin.
    '''
    if not logged_in(request):
        return HTTPFound(location=request.route_url('login'))
    form = SelectCoursesForm()
    csrf_token = request.session.get_csrf_token()

    submitter_email = request.session['uniqueName'] + '@' + \
        request.registry.settings['EMAIL_DOMAIN']
    name = request.session['firstName'] + ' ' + request.session['lastName']
    sender = request.registry.settings['mail.username']

    '''remove for production'''
    submitter_email = '[email protected]'

    message = Message(subject="Course Combine Confirmation",
        sender=sender,
        recipients=[sender, submitter_email])
    message.body = make_msg_text(name, submitter_email, request)
    message.html = make_msg_html(name, submitter_email, request)
    mailer = get_mailer(request)
    mailer.send_immediately(message, fail_silently=False)

    return{'csrf_token': csrf_token,
        'name': name,
        'form': form, 
        'base_course': request.session['base_course'],
        'courses_to_combine': request.session['courses_to_combine']
        }
开发者ID:lookerb,项目名称:course-combine,代码行数:34,代码来源:views.py

示例2: confirmation

# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import html [as 别名]
def confirmation(request):
    """
    Generates confirmation page and confirmation emails to user and D2L site 
    admin.
    """
    if not logged_in(request):
        return HTTPFound(location=request.route_url("login"))
    form = SelectCoursesForm()
    csrf_token = request.session.get_csrf_token()

    submitter_email = request.session["uniqueName"] + "@" + request.registry.settings["EMAIL_DOMAIN"]
    name = request.session["firstName"] + " " + request.session["lastName"]
    sender = request.registry.settings["mail.username"]

    """remove for production"""
    submitter_email = "[email protected]"

    message = Message(subject="Course Combine Confirmation", sender=sender, recipients=[sender, submitter_email])
    message.body = make_msg_text(name, submitter_email, request)
    message.html = make_msg_html(name, submitter_email, request)
    mailer = get_mailer(request)
    mailer.send_immediately(message, fail_silently=False)

    return {
        "csrf_token": csrf_token,
        "name": name,
        "form": form,
        "base_course": request.session["base_course"],
        "courses_to_combine": request.session["courses_to_combine"],
    }
开发者ID:antholo,项目名称:d2lapps,代码行数:32,代码来源:views.py

示例3: test_send_without_body

# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import html [as 别名]
    def test_send_without_body(self):

        from pyramid_mailer.message import Message
        from pyramid_mailer.mailer import Mailer
        from pyramid_mailer.exceptions import InvalidMessage

        msg = Message(subject="testing", sender="[email protected]", recipients=["[email protected]"])

        mailer = Mailer()

        self.assertRaises(InvalidMessage, mailer.send, msg)

        msg.html = "<b>test</b>"

        mailer.send(msg)
开发者ID:kristianbenoit,项目名称:pyramid_mailer,代码行数:17,代码来源:test_message.py

示例4: confirmation_page

# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import html [as 别名]
def confirmation_page(request):

    form = RequestForm()
    session = request.session
    csrf_token = session.get_csrf_token()
    
    if 'uc' not in session:
        session.flash('Please login to place request')
        return HTTPFound(location=request.route_url('login'))

    submitter_email = session['uniqueName'] + '@' + \
        request.registry.settings['EMAIL_DOMAIN']
    name = session['firstName'] + ' ' + session['lastName']
    sender = request.registry.settings['mail.username']

    # remove for production
    submitter_email = '[email protected]'

    message = Message(subject="Relay account setup",
        sender=sender,
        recipients=[sender,submitter_email])

    message.body = make_msg_html(name,
        submitter_email,
        session['requestDetails'],
        form)

    message.html = make_msg_html(name,
        submitter_email,
        session['requestDetails'],
        form)
    
    mailer = get_mailer(request)
    mailer.send_immediately(message, fail_silently=False)
    
    print request.scheme #CHECKING FOR HTTPS
    return {
        'csrf_token': csrf_token,
        'name': name,
        'form': form,
        'requestDetails': session['requestDetails']
        }
开发者ID:antholo,项目名称:camtasia_request_pyramid,代码行数:44,代码来源:views.py


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