def send_access(self):
if self.sent_email_data:
can_send = timezone.now() - self.sent_email_data > datetime.timedelta(minutes=settings.SEND_ACCESS_INTERVAL)
else:
can_send = True
if can_send:
self.sent_email_data = timezone.now()
self.save()
if settings.SEND_EMAILS:
message = render_to_string('application/email/draft.txt', {'uuid': self.uuid, 'email': self.email,})
email = EmailMessage(
subject='OpenCon 2016 Draft Application',
body=message,
from_email=settings.DEFAULT_FROM_EMAIL,
to=[self.email],
)
email.content_subtype = "html"
email.send(fail_silently=True)
return True
return False
评论列表
文章目录