def send_been_added_to_subscription(email, password, hash, name, shares, welcome=True): if welcome: plaintext = get_template(Config.emails('co_welcome')) else: plaintext = get_template(Config.emails('co_added')) d = { 'username': email, 'name': name, 'password': password, 'hash': hash, 'shares': shares, 'serverurl': get_server() } content = plaintext.render(d) msg = EmailMultiAlternatives( 'Willkommen bei ' + Config.organisation_name(), content, Config.info_email(), [email]) send_mail_multi(msg)
def send_job_canceled(emails, job): plaintext = get_template(Config.emails('j_canceled')) d = {'job': job, 'serverurl': get_server()} content = plaintext.render(d) send_mail( _('{0} - Einsatz abgesagt').format(Config.organisation_name()), content, Config.info_email(), emails)
def send_been_added_to_subscription(email, password, onetime_code, name, shares, welcome=True): if welcome: plaintext = get_template(Config.emails('co_welcome')) else: plaintext = get_template(Config.emails('co_added')) d = { 'username': email, 'name': name, 'password': password, 'onetime_code': onetime_code, 'shares': shares, 'serverurl': get_server() } content = plaintext.render(d) send_mail(_('Willkommen bei {0}').format(enriched_organisation('D')), content, Config.info_email(), [email])
def send_share_created_mail(member, share): plaintext = get_template(Config.emails('s_created')) d = { 'share': share, 'serverurl': get_server() } content = plaintext.render(d) send_mail(_('Dein neuer Anteilschein'), content, Config.info_email(), [member.email])
def send_depot_changed(emails, depot): plaintext = get_template(Config.emails('d_changed')) d = {'depot': depot, 'serverurl': get_server()} content = plaintext.render(d) send_mail( _('{0} - {1} geändert').format(Config.organisation_name(), Config.vocabulary('depot')), content, Config.info_email(), emails)
def send_job_time_changed(emails, job): plaintext = get_template(Config.emails('j_changed')) d = {'job': job, 'serverurl': get_server()} content = plaintext.render(d) # ical_content = genecrate_ical_for_job(job) send_mail( _('{0} - Einsatz-Zeit geändert').format(Config.organisation_name()), content, Config.info_email(), emails)
def send_job_signup(emails, job): plaintext = get_template(Config.emails('j_signup')) d = {'job': job, 'serverurl': get_server()} content = plaintext.render(d) # ical_content = generate_ical_for_job(job) send_mail( _('{0} - für Einsatz angemeldet').format(Config.organisation_name()), content, Config.info_email(), emails)
def send_confirm_mail(member): plaintext = get_template(Config.emails('confirm')) d = { 'hash': hashlib.sha1((member.email + str( member.id)).encode('utf8')).hexdigest(), 'serverurl': get_server() } content = plaintext.render(d) send_mail(_('{0} - Email Adresse ändern').format(Config.organisation_name()), content, Config.info_email(), [member.email])
def send_subscription_canceled(subscription, message): plaintext = get_template(Config.emails('s_canceled')) d = { 'subscription': subscription, 'message': message, } content = plaintext.render(d) emails = [Config.info_email()] send_mail(_('{0} - {1} gekündigt').format(Config.organisation_name(), Config.vocabulary('subscription')), content, Config.info_email(), emails)
def send_share_created_mail(member, share): plaintext = get_template(Config.emails('s_created')) d = {'share': share, 'serverurl': get_server()} content = plaintext.render(d) msg = EmailMultiAlternatives('Dein neuer Anteilschein', content, Config.info_email(), [member.email]) send_mail_multi(msg)
def send_mail_password_reset(email, password): plaintext = get_template(Config.emails('password')) subject = _('Dein neues {0} Passwort').format(Config.organisation_name()) d = { 'email': email, 'password': password, 'serverurl': get_server() } content = plaintext.render(d) send_mail(subject, content, Config.info_email(), [email])
def send_depot_changed(emails, depot): plaintext = get_template(Config.emails('d_changed')) d = {'depot': depot, 'serverurl': get_server()} content = plaintext.render(d) msg = EmailMultiAlternatives( Config.organisation_name() + ' - Depot geändert', content, Config.info_email(), emails) send_mail_multi(msg)
def send_job_canceled(emails, job): plaintext = get_template(Config.emails('j_canceled')) d = {'job': job, 'serverurl': get_server()} content = plaintext.render(d) msg = EmailMultiAlternatives( Config.organisation_name() + ' - Job-Abgesagt', content, Config.info_email(), emails) send_mail_multi(msg)
def send_bill_share(bill, share, member): plaintext = get_template(Config.emails('b_share')) d = { 'member': member, 'bill': bill, 'share': share, 'serverurl': get_server() } content = plaintext.render(d) send_mail(_('{0} - Rechnung {1}').format(Config.organisation_name(), Config.vocabulary('share')), content, Config.info_email(), [member.email])
def send_mail_password_reset(email, password): plaintext = get_template(Config.emails('password')) subject = 'Dein neues ' + Config.organisation_name() + ' Passwort' d = {'email': email, 'password': password, 'serverurl': get_server()} content = plaintext.render(d) msg = EmailMultiAlternatives(subject, content, Config.info_email(), [email]) send_mail_multi(msg)
def send_welcome_mail(email, password, onetime_code, subscription): plaintext = get_template(Config.emails('welcome')) d = { 'username': email, 'password': password, 'onetime_code': onetime_code, 'subscription': subscription, 'serverurl': get_server() } content = plaintext.render(d) send_mail(_('Willkommen bei {0}').format(enriched_organisation('D')), content, Config.info_email(), [email])
def send_membership_canceled(member, end_date, message): plaintext = get_template(Config.emails('m_canceled')) d = { 'member': member, 'end_date': end_date, 'message': message, } content = plaintext.render(d) emails = [Config.info_email()] send_mail(_('{0} - {1} gekündigt').format(Config.organisation_name(), Config.vocabulary('member_type')), content, Config.info_email(), emails)
def send_bill_extrasub(bill, extrasub, start, end, member): plaintext = get_template(Config.emails('b_esub')) d = { 'member': member, 'bill': bill, 'extrasub': extrasub, 'start': start, 'end': end, 'serverurl': get_server() } content = plaintext.render(d) send_mail(_('{0} - Rechnung Extra-Abo').format(Config.organisation_name()), content, Config.info_email(), [member.email])
def send_bill_sub(bill, subscription, start, end, member): plaintext = get_template(Config.emails('b_sub')) d = { 'member': member, 'bill': bill, 'sub': subscription, 'start': start, 'end': end, 'serverurl': get_server() } content = plaintext.render(d) send_mail(_('{0} - Rechnung {1}').format(Config.organisation_name(), Config.vocabulary('subscription')), content, Config.info_email(), [member.email])
def send_job_time_changed(emails, job): plaintext = get_template(Config.emails('j_changed')) d = {'job': job, 'serverurl': get_server()} content = plaintext.render(d) # ical_content = genecrate_ical_for_job(job) msg = EmailMultiAlternatives( Config.organisation_name() + ' - Job-Zeit geändert', content, Config.info_email(), emails) # msg.attach('einsatz.ics', ical_content, 'text/calendar') send_mail_multi(msg)
def send_subscription_created_mail(subscription): plaintext = get_template(Config.emails('n_sub')) d = {'subscription': subscription, 'serverurl': get_server()} content = plaintext.render(d) perm = Permission.objects.get(codename='new_subscription') users = User.objects.filter( Q(groups__permissions=perm) | Q(user_permissions=perm)).distinct() emails = [] for user in users: emails.append(user.member.email) if len(emails) == 0: emails = [Config.info_email()] send_mail(_('Neuer Anteilschein erstellt'), content, Config.info_email(), emails)
def send_job_reminder(emails, job, participants): plaintext = get_template(Config.emails('j_reminder')) coordinator = job.type.activityarea.coordinator contact = coordinator.first_name + ' ' + \ coordinator.last_name + ': ' + job.type.activityarea.contact() d = { 'job': job, 'participants': participants, 'serverurl': get_server(), 'contact': contact } content = plaintext.render(d) send_mail(_('{0} - Einsatz-Erinnerung').format(Config.organisation_name()), content, Config.info_email(), emails)
def send_job_signup(emails, job): plaintext = get_template(Config.emails('j_signup')) d = {'job': job, 'serverurl': get_server()} content = plaintext.render(d) ical_content = generate_ical_for_job(job) msg = EmailMultiAlternatives( Config.organisation_name() + ' - für Job Angemeldet', content, Config.info_email(), emails) # Not attaching ics as it is not correct # msg.attach('einsatz.ics', ical_content, 'text/calendar') send_mail_multi(msg)
def send_subscription_canceled(subscription, message): plaintext = get_template(Config.emails('s_canceled')) d = { 'subscription': subscription, 'message': message, } content = plaintext.render(d) emails = [ Config.info_email(), ] msg = EmailMultiAlternatives( Config.organisation_name() + ' - Abo gekündigt', content, Config.info_email(), emails) send_mail_multi(msg)
def send_bill_share(bill, share, member): plaintext = get_template(Config.emails('b_share')) d = { 'member': member, 'bill': bill, 'share': share, 'serverurl': get_server() } content = plaintext.render(d) msg = EmailMultiAlternatives( Config.organisation_name() + ' - Rechnung Anteilschein', content, Config.info_email(), [member.email]) send_mail_multi(msg)
def send_membership_canceled(member, end_date, message): plaintext = get_template(Config.emails('m_canceled')) d = { 'member': member, 'end_date': end_date, 'message': message, } content = plaintext.render(d) emails = [ Config.info_email(), ] msg = EmailMultiAlternatives( Config.organisation_name() + ' - Abo gekündigt', content, Config.info_email(), emails) send_mail_multi(msg)
def send_welcome_mail(email, password, hash, subscription): plaintext = get_template(Config.emails('welcome')) d = { 'username': email, 'password': password, 'hash': hash, 'subscription': subscription, 'serverurl': get_server() } content = plaintext.render(d) msg = EmailMultiAlternatives( 'Willkommen bei der Genossenschaft' + Config.organisation_name(), content, Config.info_email(), [email]) send_mail_multi(msg)
def send_bill_extrasub(bill, extrasub, start, end, member): plaintext = get_template(Config.emails('b_esub')) d = { 'member': member, 'bill': bill, 'extrasub': extrasub, 'start': start, 'end': end, 'serverurl': get_server() } content = plaintext.render(d) msg = EmailMultiAlternatives( Config.organisation_name() + ' - Rechnung ExtraAbo', content, Config.info_email(), [member.email]) send_mail_multi(msg)
def send_confirm_mail(member): plaintext = get_template(Config.emails('confirm')) d = { 'hash': hashlib.sha1( (member.email + str(member.id)).encode('utf8')).hexdigest(), 'serverurl': get_server() } content = plaintext.render(d) msg = EmailMultiAlternatives( Config.organisation_name() + ' - Email Adresse bestätigen', content, Config.info_email(), [member.email]) send_mail_multi(msg)
def send_job_reminder(emails, job, participants): plaintext = get_template(Config.emails('j_reminder')) coordinator = job.type.activityarea.coordinator contact = coordinator.first_name + ' ' + coordinator.last_name + ': ' + job.type.activityarea.contact( ) d = { 'job': job, 'participants': participants, 'serverurl': get_server(), 'contact': contact } content = plaintext.render(d) msg = EmailMultiAlternatives( Config.organisation_name() + ' - Job-Erinnerung', content, Config.info_email(), emails) send_mail_multi(msg)