本文整理汇总了Python中pyramid_mailer.message.Message.body方法的典型用法代码示例。如果您正苦于以下问题:Python Message.body方法的具体用法?Python Message.body怎么用?Python Message.body使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid_mailer.message.Message
的用法示例。
在下文中一共展示了Message.body方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sendMail
# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import body [as 别名]
def sendMail(request, msg, to, username='', confirm=''):
from pyramid_mailer import get_mailer
from pyramid_mailer.message import Message
mailer = get_mailer(request)
if msg == 'confirm':
message = Message(sender="[email protected]", recipients=[to],
subject="Welcome to BarterVegasTech!")
message.body = "Hello " + username + ",\n\n" + \
"Thank you for checking out http://www.bartervegastech.com\n\n" + \
"To activate your account please go to:\nhttp://www.bartervegastech.com/message/" + \
"activate/" + username + "/" + confirm + "\n\nIf you do not wish to have an " + \
"account you may just ignore this email.\nThanks!\nBarterVegasTech.com"
if request.registry.settings['testing'] != "true":
mailer.send(message)
elif msg == 'forgot':
message = Message(sender="[email protected]", recipients=[to],
subject="BarterVegasTech Password Recovery")
message.body = "Hello " + username + ",\n\n" + \
"To reset your password please go to:\nhttp://www.bartervegastech.com/reset/" + \
username + "/" + confirm + "\n\n" + \
"If you did not request to have your password changed then " + \
"you may just ignore this email.\nThanks!\nBarterVegasTech.com"
if request.registry.settings['testing'] != "true":
mailer.send(message)
elif msg == 'reply':
message = Message(sender="[email protected]", recipients=[to],
subject="BarterVegasTech Reply")
message.body = "Hello!\n\n" + \
"You recieved a reply to your post: " + username + \
"\n\nVisit " + confirm + " to view it.\n\n" + \
"To change your email notification settings visit http://www.bartervegastech.com/account#profiletab"
if request.registry.settings['testing'] != "true":
mailer.send(message)
示例2: confirmation
# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import body [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: confirmation
# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import body [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"],
}
示例4: confirmation_page
# 需要导入模块: from pyramid_mailer.message import Message [as 别名]
# 或者: from pyramid_mailer.message.Message import body [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']
}