EmailMultiAlternatives added: Html version of information check email

parent 1c15ee75
......@@ -3,6 +3,8 @@ from datetime import timedelta
import logging
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.core import mail
from django.template import loader
from django.template.defaultfilters import floatformat
......@@ -94,17 +96,21 @@ def send_information_request(dry_run=False):
'programme': member.profile.get_programme_display()
email_body = loader.render_to_string(
'[THALIA] {}'.format(
_('Membership information check')),
email_context["lang_code"] = member.profile.language
html_template = get_template(
text_template = get_template(
subject = '[THALIA] ' + _('Membership information check')
html_message = html_template.render(email_context)
text_message = text_template.render(email_context)
msg = EmailMultiAlternatives(subject, text_message,
msg.attach_alternative(html_message, "text/html")
if not dry_run:
{% load i18n %}
{% load baseurl %}
{% load static from staticfiles %}
<html style="background-color: #F0F0F0;">
<title>{% trans "membership information check"|capfirst %}</title>
<div style="border-spacing:0px; font-size:15px; font-family:Arial"; width="100%">
<p class="text-center">
<div style="background-color: white; max-width:700px; margin-left:auto; margin-right: auto;">
<div style="background-color:#E6227A; color:white; text-align:center; padding:20px;">
<img src="{% baseurl %}{% static 'img/logo-magenta-bg-'|add:lang_code|add:'.png' %}" style="max-width:200px;">
<div style="width:calc(100% - 20px); padding:10px; background-color: white; max-width: calc(700px - 20px); margin-left:auto; margin-right: auto;">
{% blocktrans %}
We currently have the following information about you in our database.<br>
Via this email we'd like to ask you to check the accuracy of this data.<br>
{% endblocktrans %}
<table style="width:100%; background-color: white; max-width: 700px; font-family:Arial; font-size:15px; margin-left:auto; margin-right: auto; padding:10px" >
<td>{% trans "username:"|capfirst %}</td>
<td>{{ username }}</td>
<td>{% trans "name:"|capfirst %}</td>
<td>{{ full_name }}</td>
<td>{% trans "address:"|capfirst %}</td>
<td>{{ address_street }}<br>{{ address_street2 }}<br>{{ address_postal_code }}<br>{{ address_city }}<br>{{ address_country }}</td>
<td>{% trans "phone:"|capfirst %}</td>
<td>{{ phone_number }}</td>
<td>{% trans "date of birth:"|capfirst %}</td>
<td>{{ birthday }}</td>
<td>{% trans "email address:"|capfirst %}</td>
<td>{{ email }}</td>
<td>{% trans "student number:"|capfirst %}</td>
<td>{{ student_number }}</td>
<td>{% trans "cohort:"|capfirst %}</td>
<td>{{ starting_year }}</td>
<td>{% trans "programme:"|capfirst %}</td>
<td>{{ programme}}</td>
<div style="background-color: white; max-width:700px; margin-left:auto; margin-right: auto; padding:10px">
{% blocktrans %}
You can changige this data by logging into the website and using the 'edit profile' page.<br>
Unable to edit the incorrect information? Then send an email:<br>
With kind regards,<br>
The board of Study Association Thalia<br>
This email was automatically generated.<br>
{% endblocktrans %}
......@@ -173,7 +173,7 @@
<tr style="margin-top: 20px;">
<td style="background-color: {{ primary_color }}; overflow: hidden; padding-left:30px; padding-top: 10px; padding-bottom: 10px;">
<a href="{% baseurl %}{% url 'index' %}"><img src="{% baseurl %}{% static 'newsletters/logo-footer-'|add:lang_code|add:'.png' %}" alt="Thalia" width="180" height="75" style="float:left;width: 180px; height: 75px;"></a>
<a href="{% baseurl %}{% url 'index' %}"><img src="{% baseurl %}{% static 'img/logo-magenta-bg-'|add:lang_code|add:'.png' %}" alt="Thalia" width="180" height="75" style="float:left;width: 180px; height: 75px;"></a>
<td align="center" style="background-color: black; color: white;font-size: 12px; padding: 10px;">
<p style="font-size: 18px; color: white; font-family: 'Calibri', 'Trebuchet MS', sans-serif;">
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment