本文整理汇总了Python中turbomail.Message.reply_to方法的典型用法代码示例。如果您正苦于以下问题:Python Message.reply_to方法的具体用法?Python Message.reply_to怎么用?Python Message.reply_to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类turbomail.Message
的用法示例。
在下文中一共展示了Message.reply_to方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_email_students
# 需要导入模块: from turbomail import Message [as 别名]
# 或者: from turbomail.Message import reply_to [as 别名]
def do_email_students(self):
log.debug(str(request.params))
user = h.get_user(request.environ)
student_ids_str = request.params['student_ids']
student_ids = ah.fileset_id_string_to_id_list(student_ids_str)
students = Student.query.filter(Student.id.in_(student_ids)).all()
students = filter(lambda student: request.params.has_key(str(student.id)), students)
for student in students:
check_student_access(student)
subject = request.params['subject']
body = request.params['body']
from_addr = (user.givenName+" "+user.surName,user.name + '@illinois.edu')
reply_to = user.name + '@illinois.edu'
to_addrs = map(lambda student: (student.displayName, student.netid + "@illinois.edu"), students)
from turbomail import Message
message = Message()
message.subject = subject
message.plain = body
message.author = from_addr
message.reply_to = reply_to
message.to = to_addrs
message.cc = from_addr
message.send()
if request.params.has_key('assignment_id'):
return redirect_to(controller='view_analysis', action='view', id=request.params['assignment_id'])
else:
return redirect_to(controller='view_analysis', action='list')
示例2: send
# 需要导入模块: from turbomail import Message [as 别名]
# 或者: from turbomail.Message import reply_to [as 别名]
def send(to, template_path, context=None, reply_to='', bcc='[email protected]'):
"""
Send message based on a mako template. The recipient is automatically added
to the context_dict that gets fed to the template.
"""
t = EMAIL_TEMPLATE_LOOKUP.get_template(template_path)
context = context or {}
context['url_for'] = absolute_url_for
def get_email(u, set_context=True):
if isinstance(u, users.User):
if set_context: context['user'] = u
return u.email
return u
if isinstance(to, users.User):
to = get_email(to)
if isinstance(to, (list, tuple)):
to = [get_email(u, set_context=False) for u in to]
pc = pylons.config
subject = t.get_def('subject').render_unicode(**context).strip()
body = line_reduce(t.render_unicode(**context).strip())
f = (pc['mail.message.author_name'], pc['mail.message.author'])
reroute = pc.get('mail.reroute')
if reroute:
old_to = to
to = reroute
lmsg = 'Sending email from %s to %s.' % (f, to)
if reroute:
lmsg += ' Message was rerouted from %s' % old_to
logger.info(lmsg)
msg = Message(f, to, subject, plain=body)
msg.plain = body
msg.bcc = bcc
if reply_to:
msg.reply_to = reply_to
msg.send()
示例3: do_email_students_ajax
# 需要导入模块: from turbomail import Message [as 别名]
# 或者: from turbomail.Message import reply_to [as 别名]
def do_email_students_ajax(self):
log.debug(str(request.params))
user = h.get_user(request.environ)
student_ids_str = request.params['student_ids']
student_ids = ah.fileset_id_string_to_id_list(student_ids_str)
students = Student.query.filter(Student.id.in_(student_ids)).all()
students = filter(lambda student: request.params.has_key(str(student.id)), students)
for student in students:
check_student_access(student)
subject = request.params['subject']
body = request.params['body']
from_addr = (user.givenName+" "+user.surName,user.name + '@illinois.edu')
reply_to = user.name + '@illinois.edu'
to_addrs = map(lambda student: (student.displayName, student.netid + "@illinois.edu"), students)
from turbomail import Message
message = Message()
message.subject = subject
message.plain = body
message.author = from_addr
message.reply_to = reply_to
message.to = to_addrs
message.cc = from_addr
message.send()
return "Message Sent Successfully"