correct email formatting
authorymh <ymh.work@gmail.com>
Wed, 11 Mar 2015 17:05:08 +0100
changeset 530 5d3b4e1e5b34
parent 529 f479d60ca502
child 531 82758bd0ce10
correct email formatting
src/hdalab/management/commands/send_moderation_mail.py
src/hdalab/signals.py
src/hdalab/static/hdalab/css/email.css
src/hdalab/templates/mails/moderation_notice.html
src/hdalab/templates/mails/published_renkan.html
src/hdalab/templates/mails/rejected_renkan.html
src/hdalab/templates/mails/unpublished_renkan.html
virtualenv/res/lib/lib_create_env.py
virtualenv/res/src/cssselect-0.9.1.tar.gz
virtualenv/res/src/cssutils-1.0.tar.gz
virtualenv/res/src/premailer-2.8.3.tar.gz
virtualenv/web/res/requirements.txt
--- a/src/hdalab/management/commands/send_moderation_mail.py	Tue Mar 10 18:41:29 2015 +0100
+++ b/src/hdalab/management/commands/send_moderation_mail.py	Wed Mar 11 17:05:08 2015 +0100
@@ -6,6 +6,7 @@
 '''
 
 import logging
+import os
 
 from django.conf import settings
 from django.contrib.auth import get_user_model
@@ -14,6 +15,7 @@
 from django.core.management.base import NoArgsCommand
 from django.template.base import TemplateDoesNotExist
 from django.template.loader import render_to_string
+import premailer
 
 from hdalab.models.renkan import HdalabRenkan
 
@@ -52,8 +54,8 @@
                         'WEB_URL': settings.WEB_URL,
                         'email_recipient': email_recipient
                     }
-                    msg_html = render_to_string(TEMPLATE_NAME+".txt", context)
-                    msg_txt = render_to_string(TEMPLATE_NAME+".html", context)
+                    msg_html = premailer.transform(render_to_string(TEMPLATE_NAME+".html", context), base_url=os.path.join(settings.STATIC_ROOT,'site'))
+                    msg_txt = render_to_string(TEMPLATE_NAME+".txt", context)
                 except TemplateDoesNotExist:
                     logger.error("Mail template %s not found", TEMPLATE_NAME)
                     return
--- a/src/hdalab/signals.py	Tue Mar 10 18:41:29 2015 +0100
+++ b/src/hdalab/signals.py	Wed Mar 11 17:05:08 2015 +0100
@@ -5,16 +5,17 @@
 @author: ymh
 '''
 import logging
+import os
+from renkanmanager.models import Renkan
 
 from django.conf import settings
 from django.core.mail.message import EmailMultiAlternatives
 from django.db.models.signals import post_save, pre_delete
 from django.template.base import TemplateDoesNotExist
 from django.template.loader import render_to_string
-from django.utils.html import strip_tags
+import premailer
 
 from hdalab.models.renkan import HdalabRenkan, HdalabRenkanStateTransition
-from renkanmanager.models import Renkan
 
 
 logger = logging.getLogger(__name__)
@@ -23,6 +24,7 @@
     (HdalabRenkan.MODERATED,HdalabRenkan.PUBLISHED): ("mails/published_renkan", "Renkan publié"),
     (HdalabRenkan.MODERATED,HdalabRenkan.REJECTED): ("mails/rejected_renkan", "Renkan rejeté"),
     (HdalabRenkan.PUBLISHED, HdalabRenkan.EDITION): ("mails/unpublished_renkan", "Renkan dépublié"),
+    (HdalabRenkan.PUBLISHED, HdalabRenkan.REJECTED): ("mails/rejected_renkan", "Renkan rejeté"),
 }
 
 
@@ -40,17 +42,19 @@
         template_name, subject = MAIL_TEMPLATES[template_key]
 #        template = loader.get_template(template_name)
         context = {'renkan_state': renkan_state, 'WEB_URL': settings.WEB_URL}
-        msg_html = render_to_string(template_name+".txt", context)
-        msg_txt = render_to_string(template_name+".html", context)
+        msg_html = premailer.transform(render_to_string(template_name+".html", context), base_url=os.path.join(settings.STATIC_ROOT,'site'))
+        msg_txt = render_to_string(template_name+".txt", context)
     except TemplateDoesNotExist:
         logger.error("Mail template %s for state %s not found", MAIL_TEMPLATES[template_key], HdalabRenkan.STATE_CHOICES_DICT[renkan_state.to_state])
         return
-    except Exception as e:
-        logger.error("Error rendering template %s for state %s : %r", MAIL_TEMPLATES[template_key], HdalabRenkan.STATE_CHOICES_DICT[renkan_state.to_state], e)
+#    except Exception as e:
+#        logger.error("Error rendering template %s for state %s : %r", MAIL_TEMPLATES[template_key], HdalabRenkan.STATE_CHOICES_DICT[renkan_state.to_state], e)
+#        return
+#        raise e
     
     if msg_txt and msg_html and renkan_state.renkan and renkan_state.renkan.renkan and renkan_state.renkan.renkan.owner and renkan_state.renkan.renkan.owner.email:
         logger.debug("Sending following mail to %s : %s", renkan_state.renkan.renkan.owner.email, msg_txt)
-        emsg = EmailMultiAlternatives(subject, strip_tags(msg_txt), settings.DEFAULT_FROM_EMAIL, [renkan_state.renkan.renkan.owner.email])
+        emsg = EmailMultiAlternatives(subject, msg_txt, settings.DEFAULT_FROM_EMAIL, [renkan_state.renkan.renkan.owner.email])
         emsg.attach_alternative(msg_html, "text/html")
         emsg.send(fail_silently=True)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hdalab/static/hdalab/css/email.css	Wed Mar 11 17:05:08 2015 +0100
@@ -0,0 +1,170 @@
+@CHARSET "UTF-8";
+
+/* -------------------------------------
+        GLOBAL
+------------------------------------- */
+* {
+    margin: 0;
+    padding: 0;
+    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
+    font-size: 100%;
+    line-height: 1.6;
+}
+
+img {
+    max-width: 100%;
+}
+
+body {
+    -webkit-font-smoothing: antialiased;
+    -webkit-text-size-adjust: none;
+    width: 100%!important;
+    height: 100%;
+}
+
+
+/* -------------------------------------
+        ELEMENTS
+------------------------------------- */
+a {
+    color: #348eda;
+}
+
+.btn-primary {
+    text-decoration: none;
+    color: #FFF;
+    background-color: #348eda;
+    border: solid #348eda;
+    border-width: 10px 20px;
+    line-height: 2;
+    font-weight: bold;
+    margin-right: 10px;
+    text-align: center;
+    cursor: pointer;
+    display: inline-block;
+    border-radius: 25px;
+}
+
+.btn-secondary {
+    text-decoration: none;
+    color: #FFF;
+    background-color: #aaa;
+    border: solid #aaa;
+    border-width: 10px 20px;
+    line-height: 2;
+    font-weight: bold;
+    margin-right: 10px;
+    text-align: center;
+    cursor: pointer;
+    display: inline-block;
+    border-radius: 25px;
+}
+
+.last {
+    margin-bottom: 0;
+}
+
+.first {
+    margin-top: 0;
+}
+
+.padding {
+    padding: 10px 0;
+}
+
+
+/* -------------------------------------
+        BODY
+------------------------------------- */
+table.body-wrap {
+    width: 100%;
+    padding: 20px;
+}
+
+table.body-wrap .container {
+    border: 1px solid #f0f0f0;
+}
+
+
+/* -------------------------------------
+        FOOTER
+------------------------------------- */
+table.footer-wrap {
+    width: 100%;    
+    clear: both!important;
+}
+
+.footer-wrap .container p {
+    font-size: 12px;
+    color: #666;
+    
+}
+
+table.footer-wrap a {
+    color: #999;
+}
+
+
+/* -------------------------------------
+        TYPOGRAPHY
+------------------------------------- */
+h1, h2, h3 {
+    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
+    line-height: 1.1;
+    margin-bottom: 15px;
+    color: #000;
+    margin: 40px 0 10px;
+    line-height: 1.2;
+    font-weight: 200;
+}
+
+h1 {
+    font-size: 36px;
+}
+h2 {
+    font-size: 28px;
+}
+h3 {
+    font-size: 22px;
+}
+
+p, ul, ol {
+    margin-bottom: 10px;
+    font-weight: normal;
+    font-size: 14px;
+}
+
+ul li, ol li {
+    margin-left: 5px;
+    list-style-position: inside;
+}
+
+/* ---------------------------------------------------
+        RESPONSIVENESS
+
+------------------------------------------------------ */
+
+/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
+.container {
+    display: block!important;
+    max-width: 600px!important;
+    margin: 0 auto!important; /* makes it centered */
+    clear: both!important;
+}
+
+/* Set the padding on the td rather than the div for Outlook compatibility */
+.body-wrap .container {
+    padding: 20px;
+}
+
+/* This should also be a block element, so that it will fill 100% of the .container */
+.content {
+    max-width: 600px;
+    margin: 0 auto;
+    display: block;
+}
+
+/* Let's make sure tables in the content area are 100% wide */
+.content table {
+    width: 100%;
+}
--- a/src/hdalab/templates/mails/moderation_notice.html	Tue Mar 10 18:41:29 2015 +0100
+++ b/src/hdalab/templates/mails/moderation_notice.html	Wed Mar 11 17:05:08 2015 +0100
@@ -5,177 +5,7 @@
 <meta name="viewport" content="width=device-width" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>Renkan à modérer</title>
-<style>
-/* -------------------------------------
-        GLOBAL
-------------------------------------- */
-* {
-    margin: 0;
-    padding: 0;
-    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
-    font-size: 100%;
-    line-height: 1.6;
-}
-
-img {
-    max-width: 100%;
-}
-
-body {
-    -webkit-font-smoothing: antialiased;
-    -webkit-text-size-adjust: none;
-    width: 100%!important;
-    height: 100%;
-}
-
-
-/* -------------------------------------
-        ELEMENTS
-------------------------------------- */
-a {
-    color: #348eda;
-}
-
-.btn-primary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #348eda;
-    border: solid #348eda;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.btn-secondary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #aaa;
-    border: solid #aaa;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.last {
-    margin-bottom: 0;
-}
-
-.first {
-    margin-top: 0;
-}
-
-.padding {
-    padding: 10px 0;
-}
-
-
-/* -------------------------------------
-        BODY
-------------------------------------- */
-table.body-wrap {
-    width: 100%;
-    padding: 20px;
-}
-
-table.body-wrap .container {
-    border: 1px solid #f0f0f0;
-}
-
-
-/* -------------------------------------
-        FOOTER
-------------------------------------- */
-table.footer-wrap {
-    width: 100%;    
-    clear: both!important;
-}
-
-.footer-wrap .container p {
-    font-size: 12px;
-    color: #666;
-    
-}
-
-table.footer-wrap a {
-    color: #999;
-}
-
-
-/* -------------------------------------
-        TYPOGRAPHY
-------------------------------------- */
-h1, h2, h3 {
-    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
-    line-height: 1.1;
-    margin-bottom: 15px;
-    color: #000;
-    margin: 40px 0 10px;
-    line-height: 1.2;
-    font-weight: 200;
-}
-
-h1 {
-    font-size: 36px;
-}
-h2 {
-    font-size: 28px;
-}
-h3 {
-    font-size: 22px;
-}
-
-p, ul, ol {
-    margin-bottom: 10px;
-    font-weight: normal;
-    font-size: 14px;
-}
-
-ul li, ol li {
-    margin-left: 5px;
-    list-style-position: inside;
-}
-
-/* ---------------------------------------------------
-        RESPONSIVENESS
-
------------------------------------------------------- */
-
-/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
-.container {
-    display: block!important;
-    max-width: 600px!important;
-    margin: 0 auto!important; /* makes it centered */
-    clear: both!important;
-}
-
-/* Set the padding on the td rather than the div for Outlook compatibility */
-.body-wrap .container {
-    padding: 20px;
-}
-
-/* This should also be a block element, so that it will fill 100% of the .container */
-.content {
-    max-width: 600px;
-    margin: 0 auto;
-    display: block;
-}
-
-/* Let's make sure tables in the content area are 100% wide */
-.content table {
-    width: 100%;
-}
-
-</style>
+<link rel="stylesheet" type="text/css" href="hdalab/css/email.css" />
 </head>
 
 <body bgcolor="#f6f6f6">
--- a/src/hdalab/templates/mails/published_renkan.html	Tue Mar 10 18:41:29 2015 +0100
+++ b/src/hdalab/templates/mails/published_renkan.html	Wed Mar 11 17:05:08 2015 +0100
@@ -5,177 +5,7 @@
 <meta name="viewport" content="width=device-width" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>Renkan publié</title>
-<style>
-/* -------------------------------------
-        GLOBAL
-------------------------------------- */
-* {
-    margin: 0;
-    padding: 0;
-    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
-    font-size: 100%;
-    line-height: 1.6;
-}
-
-img {
-    max-width: 100%;
-}
-
-body {
-    -webkit-font-smoothing: antialiased;
-    -webkit-text-size-adjust: none;
-    width: 100%!important;
-    height: 100%;
-}
-
-
-/* -------------------------------------
-        ELEMENTS
-------------------------------------- */
-a {
-    color: #348eda;
-}
-
-.btn-primary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #348eda;
-    border: solid #348eda;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.btn-secondary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #aaa;
-    border: solid #aaa;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.last {
-    margin-bottom: 0;
-}
-
-.first {
-    margin-top: 0;
-}
-
-.padding {
-    padding: 10px 0;
-}
-
-
-/* -------------------------------------
-        BODY
-------------------------------------- */
-table.body-wrap {
-    width: 100%;
-    padding: 20px;
-}
-
-table.body-wrap .container {
-    border: 1px solid #f0f0f0;
-}
-
-
-/* -------------------------------------
-        FOOTER
-------------------------------------- */
-table.footer-wrap {
-    width: 100%;    
-    clear: both!important;
-}
-
-.footer-wrap .container p {
-    font-size: 12px;
-    color: #666;
-    
-}
-
-table.footer-wrap a {
-    color: #999;
-}
-
-
-/* -------------------------------------
-        TYPOGRAPHY
-------------------------------------- */
-h1, h2, h3 {
-    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
-    line-height: 1.1;
-    margin-bottom: 15px;
-    color: #000;
-    margin: 40px 0 10px;
-    line-height: 1.2;
-    font-weight: 200;
-}
-
-h1 {
-    font-size: 36px;
-}
-h2 {
-    font-size: 28px;
-}
-h3 {
-    font-size: 22px;
-}
-
-p, ul, ol {
-    margin-bottom: 10px;
-    font-weight: normal;
-    font-size: 14px;
-}
-
-ul li, ol li {
-    margin-left: 5px;
-    list-style-position: inside;
-}
-
-/* ---------------------------------------------------
-        RESPONSIVENESS
-
------------------------------------------------------- */
-
-/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
-.container {
-    display: block!important;
-    max-width: 600px!important;
-    margin: 0 auto!important; /* makes it centered */
-    clear: both!important;
-}
-
-/* Set the padding on the td rather than the div for Outlook compatibility */
-.body-wrap .container {
-    padding: 20px;
-}
-
-/* This should also be a block element, so that it will fill 100% of the .container */
-.content {
-    max-width: 600px;
-    margin: 0 auto;
-    display: block;
-}
-
-/* Let's make sure tables in the content area are 100% wide */
-.content table {
-    width: 100%;
-}
-
-</style>
+<link rel="stylesheet" type="text/css" href="hdalab/css/email.css" />
 </head>
 
 <body bgcolor="#f6f6f6">
--- a/src/hdalab/templates/mails/rejected_renkan.html	Tue Mar 10 18:41:29 2015 +0100
+++ b/src/hdalab/templates/mails/rejected_renkan.html	Wed Mar 11 17:05:08 2015 +0100
@@ -5,177 +5,7 @@
 <meta name="viewport" content="width=device-width" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>Renkan rejeté</title>
-<style>
-/* -------------------------------------
-        GLOBAL
-------------------------------------- */
-* {
-    margin: 0;
-    padding: 0;
-    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
-    font-size: 100%;
-    line-height: 1.6;
-}
-
-img {
-    max-width: 100%;
-}
-
-body {
-    -webkit-font-smoothing: antialiased;
-    -webkit-text-size-adjust: none;
-    width: 100%!important;
-    height: 100%;
-}
-
-
-/* -------------------------------------
-        ELEMENTS
-------------------------------------- */
-a {
-    color: #348eda;
-}
-
-.btn-primary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #348eda;
-    border: solid #348eda;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.btn-secondary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #aaa;
-    border: solid #aaa;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.last {
-    margin-bottom: 0;
-}
-
-.first {
-    margin-top: 0;
-}
-
-.padding {
-    padding: 10px 0;
-}
-
-
-/* -------------------------------------
-        BODY
-------------------------------------- */
-table.body-wrap {
-    width: 100%;
-    padding: 20px;
-}
-
-table.body-wrap .container {
-    border: 1px solid #f0f0f0;
-}
-
-
-/* -------------------------------------
-        FOOTER
-------------------------------------- */
-table.footer-wrap {
-    width: 100%;    
-    clear: both!important;
-}
-
-.footer-wrap .container p {
-    font-size: 12px;
-    color: #666;
-    
-}
-
-table.footer-wrap a {
-    color: #999;
-}
-
-
-/* -------------------------------------
-        TYPOGRAPHY
-------------------------------------- */
-h1, h2, h3 {
-    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
-    line-height: 1.1;
-    margin-bottom: 15px;
-    color: #000;
-    margin: 40px 0 10px;
-    line-height: 1.2;
-    font-weight: 200;
-}
-
-h1 {
-    font-size: 36px;
-}
-h2 {
-    font-size: 28px;
-}
-h3 {
-    font-size: 22px;
-}
-
-p, ul, ol {
-    margin-bottom: 10px;
-    font-weight: normal;
-    font-size: 14px;
-}
-
-ul li, ol li {
-    margin-left: 5px;
-    list-style-position: inside;
-}
-
-/* ---------------------------------------------------
-        RESPONSIVENESS
-
------------------------------------------------------- */
-
-/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
-.container {
-    display: block!important;
-    max-width: 600px!important;
-    margin: 0 auto!important; /* makes it centered */
-    clear: both!important;
-}
-
-/* Set the padding on the td rather than the div for Outlook compatibility */
-.body-wrap .container {
-    padding: 20px;
-}
-
-/* This should also be a block element, so that it will fill 100% of the .container */
-.content {
-    max-width: 600px;
-    margin: 0 auto;
-    display: block;
-}
-
-/* Let's make sure tables in the content area are 100% wide */
-.content table {
-    width: 100%;
-}
-
-</style>
+<link rel="stylesheet" type="text/css" href="hdalab/css/email.css" />
 </head>
 
 <body bgcolor="#f6f6f6">
--- a/src/hdalab/templates/mails/unpublished_renkan.html	Tue Mar 10 18:41:29 2015 +0100
+++ b/src/hdalab/templates/mails/unpublished_renkan.html	Wed Mar 11 17:05:08 2015 +0100
@@ -5,177 +5,7 @@
 <meta name="viewport" content="width=device-width" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>Renkan dépublié</title>
-<style>
-/* -------------------------------------
-        GLOBAL
-------------------------------------- */
-* {
-    margin: 0;
-    padding: 0;
-    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
-    font-size: 100%;
-    line-height: 1.6;
-}
-
-img {
-    max-width: 100%;
-}
-
-body {
-    -webkit-font-smoothing: antialiased;
-    -webkit-text-size-adjust: none;
-    width: 100%!important;
-    height: 100%;
-}
-
-
-/* -------------------------------------
-        ELEMENTS
-------------------------------------- */
-a {
-    color: #348eda;
-}
-
-.btn-primary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #348eda;
-    border: solid #348eda;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.btn-secondary {
-    text-decoration: none;
-    color: #FFF;
-    background-color: #aaa;
-    border: solid #aaa;
-    border-width: 10px 20px;
-    line-height: 2;
-    font-weight: bold;
-    margin-right: 10px;
-    text-align: center;
-    cursor: pointer;
-    display: inline-block;
-    border-radius: 25px;
-}
-
-.last {
-    margin-bottom: 0;
-}
-
-.first {
-    margin-top: 0;
-}
-
-.padding {
-    padding: 10px 0;
-}
-
-
-/* -------------------------------------
-        BODY
-------------------------------------- */
-table.body-wrap {
-    width: 100%;
-    padding: 20px;
-}
-
-table.body-wrap .container {
-    border: 1px solid #f0f0f0;
-}
-
-
-/* -------------------------------------
-        FOOTER
-------------------------------------- */
-table.footer-wrap {
-    width: 100%;    
-    clear: both!important;
-}
-
-.footer-wrap .container p {
-    font-size: 12px;
-    color: #666;
-    
-}
-
-table.footer-wrap a {
-    color: #999;
-}
-
-
-/* -------------------------------------
-        TYPOGRAPHY
-------------------------------------- */
-h1, h2, h3 {
-    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
-    line-height: 1.1;
-    margin-bottom: 15px;
-    color: #000;
-    margin: 40px 0 10px;
-    line-height: 1.2;
-    font-weight: 200;
-}
-
-h1 {
-    font-size: 36px;
-}
-h2 {
-    font-size: 28px;
-}
-h3 {
-    font-size: 22px;
-}
-
-p, ul, ol {
-    margin-bottom: 10px;
-    font-weight: normal;
-    font-size: 14px;
-}
-
-ul li, ol li {
-    margin-left: 5px;
-    list-style-position: inside;
-}
-
-/* ---------------------------------------------------
-        RESPONSIVENESS
-
------------------------------------------------------- */
-
-/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
-.container {
-    display: block!important;
-    max-width: 600px!important;
-    margin: 0 auto!important; /* makes it centered */
-    clear: both!important;
-}
-
-/* Set the padding on the td rather than the div for Outlook compatibility */
-.body-wrap .container {
-    padding: 20px;
-}
-
-/* This should also be a block element, so that it will fill 100% of the .container */
-.content {
-    max-width: 600px;
-    margin: 0 auto;
-    display: block;
-}
-
-/* Let's make sure tables in the content area are 100% wide */
-.content table {
-    width: 100%;
-}
-
-</style>
+<link rel="stylesheet" type="text/css" href="hdalab/css/email.css" />
 </head>
 
 <body bgcolor="#f6f6f6">
--- a/virtualenv/res/lib/lib_create_env.py	Tue Mar 10 18:41:29 2015 +0100
+++ b/virtualenv/res/lib/lib_create_env.py	Wed Mar 11 17:05:08 2015 +0100
@@ -59,6 +59,9 @@
     'CELERY-EMAIL': { 'setup': 'django-celery-email', 'url':'https://github.com/pmclanahan/django-celery-email/archive/1.1.0.tar.gz', 'local':"django-celery-email-1.1.0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
     'DJANGO-ENVELOPE': { 'setup': 'django-envelope', 'url':'https://github.com/zsiciarz/django-envelope/archive/1.0.0.tar.gz', 'local':'django-envelope-1.0.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
     'DJANGO-HONEYPOT': { 'setup': 'django-honeypot', 'url':'https://github.com/sunlightlabs/django-honeypot/archive/0.3.0.tar.gz', 'local':'django-honeypot-0.3.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+    'CSSSELECT': { 'setup': 'cssselect', 'url':'https://github.com/SimonSapin/cssselect/archive/v0.9.1.tar.gz', 'local':'cssselect-0.9.1.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+    'CSSUTILS': { 'setup': 'cssutils', 'url':'https://bitbucket.org/cthedot/cssutils/get/v1.0.tar.gz', 'local':'cssutils-1.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+    'PREMAILER': { 'setup': 'premailer', 'url':'https://pypi.python.org/packages/source/p/premailer/premailer-2.8.3.tar.gz', 'local':'premailer-2.8.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
 }
 
 
Binary file virtualenv/res/src/cssselect-0.9.1.tar.gz has changed
Binary file virtualenv/res/src/cssutils-1.0.tar.gz has changed
Binary file virtualenv/res/src/premailer-2.8.3.tar.gz has changed
--- a/virtualenv/web/res/requirements.txt	Tue Mar 10 18:41:29 2015 +0100
+++ b/virtualenv/web/res/requirements.txt	Wed Mar 11 17:05:08 2015 +0100
@@ -13,6 +13,8 @@
 anyjson==0.3.3
 billiard==3.3.0.19
 celery==3.1.17
+cssselect==0.9.1
+cssutils==1.0
 django-appconf==1.0.1
 django-celery-email==1.1.0
 django-envelope==1.0
@@ -27,6 +29,7 @@
 isodate==0.5.1
 kombu==3.0.24
 lxml==3.4.0
+premailer==2.8.3
 psycopg2==2.5.4
 pycrypto==2.6.1
 pyparsing==2.0.3