def send_reminder_to_group(profile, template_name='greetings/birthday_reminder_to_group.html'): try: batch = Batch.objects.get(course__exact=profile.course, year__exact=profile.year_of_joining) except Batch.DoesNotExist: return if batch.code.startswith('staff'): return if profile.personal_email_id: email_id = profile.personal_email_id else: email_id = profile.college_email_id batch_email_id = '%s@%s' % (batch.code, settings.GOOGLE_APPS_DOMAIN) subject = "%s's Birthday Reminder" % profile.first_name c = {'first_name': profile.first_name, 'birth_day': profile.birth_day, 'register_number': profile.register_number, 'email_id' : email_id, } send_html_mail(template_name, c, subject, batch_email_id)
def send_introduction_mail(first_name, college_email_id): c = {'first_name': first_name,} subject = "Welcome to %s" % settings.ORGANIZATION send_html_mail('accounts/introduction_email.html', c, subject, college_email_id)
def send_introduction_mail(first_name, college_email_id): c = { 'first_name': first_name, } subject = "Welcome to %s" % settings.ORGANIZATION send_html_mail('accounts/introduction_email.html', c, subject, college_email_id)
def send_reminder_to_group(profile, template_name="greetings/birthday_reminder_to_group.html"): try: batch = Batch.objects.get(course__exact=profile.course, year__exact=profile.year_of_joining) except Batch.DoesNotExist: return if batch.code.startswith("staff"): return batch_email_id = "%s@%s" % (batch.code, settings.GOOGLE_APPS_DOMAIN) subject = "%s's Birthday Reminder" % profile.first_name c = {"first_name": profile.first_name, "birth_day": profile.birth_day, "register_number": profile.register_number} send_html_mail(template_name, c, subject, batch_email_id)
def send_birthday_greetings(profile, template_name="greetings/birthday_greetings_email.html"): c = {"first_name": profile.first_name, "organization": settings.ORGANIZATION} subject = "Happy Birthday" to = [] if profile.college_email_id: to.append(profile.college_email_id) if profile.personal_email_id: to.append(profile.personal_email_id) if profile.personal_email_id2: to.append(profile.personal_email_id2) if to: send_html_mail(template_name, c, subject, to)
def save(self, email_template_name='passwords/password_reset_email.html', request=None): """ Generates a one-use only link for resetting password and sends to the user """ personal_email_id = self.profile.personal_email_id or self.profile.personal_email_id2 request.session['personal_email_id'] = personal_email_id domain = RequestSite(request).domain c = { 'first_name': self.profile.user.first_name, 'email': personal_email_id, 'domain': domain, 'uid': int_to_base36(self.user.id), 'token': default_token_generator.make_token(self.user), } subject = "Password reset on %s" % domain send_html_mail(email_template_name, c, subject, personal_email_id, fail_silently=False)
def save(self, email_template_name='passwords/password_reset_email.html', request=None): """ Generates a one-use only link for resetting password and sends to the user """ personal_email_id = self.profile.personal_email_id or self.profile.personal_email_id2 request.session['personal_email_id'] = personal_email_id domain = RequestSite(request).domain c = { 'first_name' : self.profile.user.first_name, 'email': personal_email_id, 'domain': domain, 'uid': int_to_base36(self.user.id), 'token': default_token_generator.make_token(self.user), } subject = "Password reset on %s" % domain send_html_mail(email_template_name, c, subject, personal_email_id, fail_silently=False)