本文整理匯總了Python中turbomail.Message.cc方法的典型用法代碼示例。如果您正苦於以下問題:Python Message.cc方法的具體用法?Python Message.cc怎麽用?Python Message.cc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類turbomail.Message
的用法示例。
在下文中一共展示了Message.cc方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: do_email_students
# 需要導入模塊: from turbomail import Message [as 別名]
# 或者: from turbomail.Message import cc [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_email
# 需要導入模塊: from turbomail import Message [as 別名]
# 或者: from turbomail.Message import cc [as 別名]
def send_email(sender, truename, emails, title, plain, rich):
"""
notify using email
sending alert email to followers
"""
"""
rand send email
"""
day_str = datetime.datetime.strftime(datetime.datetime.today(), "%d%H")
sender = "Knowing <Knowing-noreply-%[email protected]>" % day_str
logging.debug("Send email %s" % ", ".join((truename, str(emails), title, plain, rich)))
try:
mail = Message()
mail.subject = title
mail.sender = sender
mail.to = u"%s <%s>" % (truename, emails[0])
if len(emails) > 1:
mail.cc = u",".join(emails[1:])
mail.encoding = "utf-8"
mail.plain = plain
mail.rich = rich
mail.send()
except Exception, e:
logging.exception("Fail to send email.")
示例3: send_mail
# 需要導入模塊: from turbomail import Message [as 別名]
# 或者: from turbomail.Message import cc [as 別名]
def send_mail(subject, body, author=None, **kwargs):
interface.start(email_config)
msg = Message(author or from_, parse_mail(kwargs.get('to', [])), subject)
msg.cc = parse_mail(kwargs.get('cc', []))
bcc = kwargs.get('bcc', [])
if not bcc:
if kwargs.get('debug', True):
bcc = debug_list
msg.bcc = parse_mail(bcc)
msg.plain = subject
msg.rich = body
[msg.attach(attachment) for attachment in kwargs.get('attachments', [])]
msg.send()
interface.stop()
示例4: do_email_students_ajax
# 需要導入模塊: from turbomail import Message [as 別名]
# 或者: from turbomail.Message import cc [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"