本文整理汇总了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']
}
示例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"],
}
示例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)
示例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']
}