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


Python mail.send_mail_to_admins方法代码示例

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


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

示例1: log_error

# 需要导入模块: from google.appengine.api import mail [as 别名]
# 或者: from google.appengine.api.mail import send_mail_to_admins [as 别名]
def log_error(subject, message, *args):
	if args:
		try:
			message = message % args
		except:
			pass

	logging.error(subject + ' : ' + message)

	subject = 'MyLife Error: ' + subject
	app_id = app_identity.get_application_id()
	sender = "MyLife Errors <errors@%s.appspotmail.com>" % app_id
	try:
		to = Settings.get().email_address
		mail.check_email_valid(to, 'To')
		mail.send_mail(sender, to, subject, message)
	except:
		mail.send_mail_to_admins(sender, subject, message) 
开发者ID:einaregilsson,项目名称:MyLife,代码行数:20,代码来源:errorhandling.py

示例2: _email_html

# 需要导入模块: from google.appengine.api import mail [as 别名]
# 或者: from google.appengine.api.mail import send_mail_to_admins [as 别名]
def _email_html(to, subject, body):
  """Sends an email including a textual representation of the HTML body.

  The body must not contain <html> or <body> tags.
  """
  mail_args = {
    'body': saxutils.unescape(re.sub(r'<[^>]+>', r'', body)),
    'html': '<html><body>%s</body></html>' % body,
    'sender': 'no_reply@%s.appspotmail.com' % app_identity.get_application_id(),
    'subject': subject,
  }
  try:
    if to:
      mail_args['to'] = to
      mail.send_mail(**mail_args)
    else:
      mail.send_mail_to_admins(**mail_args)
    return True
  except mail_errors.BadRequestError:
    return False 
开发者ID:luci,项目名称:luci-py,代码行数:22,代码来源:ui.py

示例3: SendReport

# 需要导入模块: from google.appengine.api import mail [as 别名]
# 或者: from google.appengine.api.mail import send_mail_to_admins [as 别名]
def SendReport(self, report):
    """Emails an exception report.

    Args:
      report: A string containing the report to send.
    """
    subject = ('Daily exception report for app "%s", major version "%s"'
               % (self.app_id, self.major_version))
    report_text = saxutils.unescape(re.sub('<[^>]+>', '', report))
    mail_args = {
        'sender': self.sender,
        'subject': subject,
        'body': report_text,
        'html': report,
    }
    if self.to:
      mail_args['to'] = self.to
      self.send_mail(**mail_args)
    else:
      self.send_mail_to_admins(**mail_args) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:22,代码来源:report_generator.py

示例4: __init__

# 需要导入模块: from google.appengine.api import mail [as 别名]
# 或者: from google.appengine.api.mail import send_mail_to_admins [as 别名]
def __init__(self, *args, **kwargs):
    super(ReportGenerator, self).__init__(*args, **kwargs)


    self.send_mail = mail.send_mail
    self.send_mail_to_admins = mail.send_mail_to_admins 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:8,代码来源:report_generator.py


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