本文整理汇总了Python中cloud.aws.CloudHost.send_email方法的典型用法代码示例。如果您正苦于以下问题:Python CloudHost.send_email方法的具体用法?Python CloudHost.send_email怎么用?Python CloudHost.send_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloud.aws.CloudHost
的用法示例。
在下文中一共展示了CloudHost.send_email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: auto_activate
# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import send_email [as 别名]
def auto_activate():
try:
num_mails_24h, rate = CloudHost.get_email_rates()
rate_per_second = min(JBoxd.MAX_ACTIVATIONS_PER_SEC, rate)
num_mails = min(JBoxd.MAX_AUTO_ACTIVATIONS_PER_RUN, num_mails_24h)
JBoxd.log_info("Will activate max %d users at %d per second. AWS limits: %d mails at %d per second",
num_mails, rate_per_second,
num_mails_24h, rate)
user_ids = JBoxUserV2.get_pending_activations(num_mails)
JBoxd.log_info("Got %d user_ids to be activated", len(user_ids))
for user_id in user_ids:
JBoxd.log_info("Activating %s", user_id)
# send email by SES
CloudHost.send_email(user_id, JBoxd.ACTIVATION_SENDER, JBoxd.ACTIVATION_SUBJECT, JBoxd.ACTIVATION_BODY)
# set user as activated
user = JBoxUserV2(user_id)
user.set_activation_state(JBoxUserV2.ACTIVATION_CODE_AUTO, JBoxUserV2.ACTIVATION_GRANTED)
user.save()
rate_per_second -= 1
if rate_per_second <= 0:
time.sleep(1)
rate_per_second = min(JBoxd.MAX_ACTIVATIONS_PER_SEC, rate)
finally:
JBoxd.finish_thread()
示例2: test
# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import send_email [as 别名]
def test():
CloudHost.send_email('[email protected]', '[email protected]', "test SES",
"""hello world
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.""")