def send(self, base_url=""): """ sends an email to user """ context = {'base_url': base_url, 'object': self} html_message = render_to_string("surveys/survey_email.html", context) logger.info("Sending survey (#%d) for survey #%d to user #%d at %s" % (self.id, self.survey.id, self.user.id, self.user.email)) send_html_mail(self.survey.email_subject, html_message, self.user.email) return True
def send(self, base_url=""): """ sends an email to user and updated the invitaiton status """ assert self.status == EventInvitationStatus.NEW context = {'base_url': base_url, 'object': self} subject = "%s: %s" % (unicode(_("Invitation")), self.event.title) html_message = render_to_string("emails/invitation.html", context) logger.info("Sending invitation #%d for event #%d to user #%d at %s" % (self.id, self.event.id, self.user.id, self.user.email)) send_html_mail(subject, html_message, self.user.email) self.status = EventInvitationStatus.SENT self.save() return True