本文整理匯總了Python中myrobogals.rgmessages.models.EmailMessage.sender_id方法的典型用法代碼示例。如果您正苦於以下問題:Python EmailMessage.sender_id方法的具體用法?Python EmailMessage.sender_id怎麽用?Python EmailMessage.sender_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類myrobogals.rgmessages.models.EmailMessage
的用法示例。
在下文中一共展示了EmailMessage.sender_id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_default_pass
# 需要導入模塊: from myrobogals.rgmessages.models import EmailMessage [as 別名]
# 或者: from myrobogals.rgmessages.models.EmailMessage import sender_id [as 別名]
def check_default_pass():
users = User.objects.all()
for u in users:
if check_password("newrg123", u.password):
message = EmailMessage()
message.body = "Dear " + u.first_name + ",\n\nYou are recieving this automated email because your myRobogals account is still set to use the default password. This is a security risk and exposes your myRobogals account to potentially being used by others.\n\nPlease login at http://my.robogals.org using the following credentials:\nUsername: " + u.username + "\nPassword: newrg123\n\nOnce you have logged in, please change your password.\n\nThankyou,\n\nmyRobogals password nagging bot :)"
message.subject = "Warning: Account is using default password"
message.from_address = "[email protected]"
message.from_name = "myRobogals"
message.reply_address = "[email protected]"
message.html = False
message.status = -1
message.sender_id = 168
message.save()
recipient = EmailRecipient()
recipient.message = message
recipient.user = u
recipient.to_name = u.get_full_name()
recipient.to_address = u.email
recipient.save()
message.status = 0
message.save()