parent
9963687752
commit
17834aa692
15 changed files with 443 additions and 53 deletions
@ -0,0 +1,31 @@ |
||||
# create default test newsletter for announce with attachments |
||||
|
||||
|
||||
"""Command for sending the newsletter""" |
||||
from django.conf import settings |
||||
from django.utils.translation import activate |
||||
from django.core.management.base import NoArgsCommand |
||||
|
||||
from emencia.django.newsletter.mailer import Mailer |
||||
from emencia.django.newsletter.models import Newsletter, MailingList, SMTPServer, Contact |
||||
|
||||
|
||||
class Command(NoArgsCommand): |
||||
"""Send the newsletter in queue""" |
||||
help = 'create the announce every week' |
||||
|
||||
def handle(self, *args, **options): |
||||
# creating smtp server |
||||
try: |
||||
server = SMTPServer.objects.get(id=1) |
||||
except SMTPServer.DoesNotExist: |
||||
server = SMTPServer.objects.create(id=1, name='default', host='smtp.gmail.com', user='kotzillla', |
||||
password='fitteR2006!!', port=587, tls=True, mails_hour=1000) |
||||
|
||||
# mailinglist for announce |
||||
try: |
||||
mail_list = MailingList.objects.get(id=1) |
||||
except SMTPServer.DoesNotExist: |
||||
mail_list = MailingList.objects.create(id=1, name=u'Анонсы', announce=True) |
||||
# add subscribers |
||||
mail_list.subscribers.add(Contact.objects.filter(contactsettings__theme__isnull=False)) |
||||
@ -0,0 +1,18 @@ |
||||
"""Command for sending the newsletter""" |
||||
from datetime import date, timedelta |
||||
from django.conf import settings |
||||
from django.utils.translation import activate |
||||
from django.core.management.base import NoArgsCommand |
||||
|
||||
from emencia.django.newsletter.mailer import Mailer |
||||
from emencia.django.newsletter.models import Newsletter, MailingList |
||||
|
||||
|
||||
class Command(NoArgsCommand): |
||||
"""this command run every day. check date and creates newsletter the day before announces need to send""" |
||||
help = 'create the announce every week.' |
||||
|
||||
def handle(self, *args, **options): |
||||
announce_list = MailingList.objects.get(id=1) |
||||
day = date.today()# + timedelta(days=1) |
||||
announce_list.generate_announce_newsletter(day) |
||||
@ -0,0 +1,176 @@ |
||||
<body style="margin: 0; padding: 0; min-height: 100%; background: #f4f2ee;"> |
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" bgcolor="#f4f2ee" style="font-family: Arial, sans-serif; background: #f4f2ee;"> |
||||
<tr> |
||||
<td align="center" style="padding: 50px 0"> |
||||
{# header #} |
||||
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px;"> |
||||
<tr> |
||||
<td style="vertical-align: top;"> |
||||
<div class="logo"> |
||||
<a style="text-decoration: none; color: #a2a2a2; font-size: 12px;" href="/"> |
||||
<img src="cid:logo" alt="Expomap.ru" /> |
||||
<b style="display: block; padding-left: 67px; margin-top: -5px;">Выставки, конференции, семинары</b> |
||||
</a> |
||||
</div> |
||||
</td> |
||||
<td style="vertical-align: top; padding-top: 22px;"> |
||||
<ul class="t-links" style="margin: 0 0 15px; padding: 0; list-style: none; text-align: right; font-size: 16px; line-height: 17px; font-weight: bold;"> |
||||
<li style="display: inline-block;"><a style="text-decoration: none; color: #ff6600" href="/expo/">СОБЫТИЯ</a></li> |
||||
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="/places/">МЕСТА</a></li> |
||||
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="/members/">УЧАСТНИКИ</a></li> |
||||
</ul> |
||||
|
||||
<ul class="soc-media-buttons" style="margin: 0; padding: 0; list-style: none; text-align: right;"> |
||||
<li style="display: inline-block; margin-left: 5px;"><a href="https://www.facebook.com/Expomap"><img src="cid:media_fb" title="Facebook" alt="Facebook" /></a></li> |
||||
<li style="display: inline-block; margin-left: 5px;"><a href="http://www.linkedin.com/company/expomap-ru/"><img src="cid:media_lin" title="LinkedIn" alt="LinkedIn" /></a></li> |
||||
<li style="display: inline-block; margin-left: 5px;"><a href="http://vk.com/expomap"><img src="cid:media_vk" title="В контакте" alt="В контакте" /></a></li> |
||||
<li style="display: inline-block; margin-left: 5px;"><a href="https://twitter.com/expomap_ru"><img src="cid:media_twit" title="Twitter" alt="Twitter" /></a></li> |
||||
</ul> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
{# end header #} |
||||
|
||||
{# events #} |
||||
{% with events=events %} |
||||
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; margin-bottom: 10px;"> |
||||
<tr> |
||||
<td style="padding: 20px 0 0;"><a style="display: block; padding: 25px 30px; text-decoration: none; background: #ff6600; color: #ffffff; font-size: 20px; line-height: 26px;" href="/expo/search/?{% for th in themes %}th={{ th.id }}&{% endfor %}{% if place %}co={{ place.id }}&{% endif %}">Выставки{% if place %} {{ place.inflect }}{% endif %} {% if themes|length == 1 %}по тематике:<b style="display: block; font-size: 26px;">{{ themes.0.name }}</b>{% endif %}</a></td> |
||||
</tr> |
||||
<tr> |
||||
<td style="padding: 10px 30px 15px; background: #faf9f7;"> |
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="540" style="margin-bottom: 15px;"> |
||||
{% for event in events %} |
||||
<tr valign="top"> |
||||
<td style="padding: 15px 15px 15px 0; width: 76px; border-bottom: 1px dotted #cccccc;"> |
||||
<table cellpadding="0" cellspacing="0" border="0"> |
||||
<tr> |
||||
<td style="background: #ffffff; padding: 3px; width: 70px; height: 70px; vertical-align: middle; text-align: center; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;"><a href="http://{{ domain }}{{ event.get_permanent_url }}"><img src="cid:mail_expo_logo_{{ event.id }}" style="width: 100%;" alt="" /></a></td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
<td style="padding: 15px 15px 15px 0; border-bottom: 1px dotted #cccccc;"> |
||||
<h2 style="margin: 0 0 5px; font-family: Tahoma, Arial, sans-serif; font-size: 18px; line-height: 21px;"><a style="color: #464646; text-decoration: none;" href="http://{{ domain }}{{ event.get_permanent_url }}">{{ event.name }}</a></h2> |
||||
<p style="margin: 0 0 7px; font-size: 12px; line-height: 15px; color: #a2a2a2"><a style="color: #a2a2a2; text-decoration: none;" href="http://{{ domain }}{{ event.get_permanent_url }}">{{ obj.main_title|safe }}</a></p> |
||||
<a class="button" style="display: inline-block; padding: 4px 10px 3px; text-decoration: none; color: #ff6600; font-size: 11px; font-weight: bold; line-height: 14px; border: 1px solid #feb17d; text-transform: uppercase; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;" href="http://{{ domain }}{{ event.get_permanent_url }}">добавить в расписание</a> |
||||
<div class="addr" style="margin-top: 10px; font-size: 13px; line-height: 15px;"><img src="cid:pin" width="10" height="15" alt="" style="vertical-align: middle; margin-top: -1px;" /> {{ event.country.name }}, {{ event.city.name }}{% if event.place %}, {{ event.place.name }}{% endif %}</div> |
||||
</td> |
||||
<td style="padding: 17px 0; text-align: right; font-size: 13px; line-height: 16px; color: #ff6600; width: 140px; border-bottom: 1px dotted #cccccc;"> |
||||
<img src="cid:clock" width="14" height="15" style="vertical-align: middle; margin-top: -1px;" alt="" /> {% include 'client/includes/show_date_block.html' with obj=event %} |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
</table> |
||||
|
||||
<div class="more" style="text-align: center;"> |
||||
<a class="button" style="display: inline-block; padding: 4px 10px 3px; text-decoration: none; color: #2592c5; font-size: 11px; font-weight: bold; line-height: 14px; border: 1px solid #90c7e0; text-transform: uppercase; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; width: 336px;" href="/expo/">посмотреть все события</a> |
||||
</div> |
||||
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
{% endwith %} |
||||
{# end events #} |
||||
|
||||
{% if news %} |
||||
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; margin-bottom: 10px;"> |
||||
<tr> |
||||
<td style="padding: 20px 0 0;"><a style="display: block; padding: 25px 30px; text-decoration: none; background: #ff6600; color: #ffffff; font-size: 20px; line-height: 26px;" href="/news/">Новости событий</a></td> |
||||
</tr> |
||||
<tr> |
||||
<td style="padding: 10px 30px 15px; background: #faf9f7;"> |
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="540" style="margin-bottom: 15px;"> |
||||
{% for item in news %} |
||||
<tr valign="top"> |
||||
<td style="padding: 15px 15px 15px 0; width: 76px; border-bottom: 1px dotted #cccccc;"> |
||||
<table cellpadding="0" cellspacing="0" border="0"> |
||||
<tr> |
||||
<td style="background: #ffffff; padding: 0; width: 76px; height: 76px; vertical-align: middle; text-align: center;"><a href="{{ item.get_permanent_url }}"><img style="width: 100%; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;" alt="" src="cid:mail_news_logo_{{ item.id }}" /></a></td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
<td style="padding: 15px 0; border-bottom: 1px dotted #cccccc;"> |
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom: 5px;"> |
||||
<tr> |
||||
<td><h2 style="margin: 0 0 5px; font-family: Tahoma, Arial, sans-serif; font-size: 18px; line-height: 21px;"><a style="color: #464646; text-decoration: none;" href="{{ item.get_permanent_url }}">{{ item.main_title }}</a></h2></td> |
||||
<td style="font-size: 13px; line-height: 15px; text-align: right; color: #ff6600;">{{ item.publish_date|date:"d.m.Y" }}</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p style="margin: 0 0 7px; font-size: 13px; line-height: 17px;"><a style="color: #464646; text-decoration: none;" href="{{ item.get_permanent_url }}">{{ item.preview }} <span style="text-decoration: underline; color: #ff6600;">...</span></a></p> |
||||
|
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
</table> |
||||
|
||||
<div class="more" style="text-align: center;"> |
||||
<a class="button" style="display: inline-block; padding: 4px 10px 3px; text-decoration: none; color: #2592c5; font-size: 11px; font-weight: bold; line-height: 14px; border: 1px solid #90c7e0; text-transform: uppercase; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; width: 336px;" href="/news/">посмотреть все новости</a> |
||||
</div> |
||||
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
{% endif %} |
||||
{% if blogs %} |
||||
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; margin-bottom: 10px;"> |
||||
<tr> |
||||
<td style="padding: 20px 0 0;"><a style="display: block; padding: 25px 30px; text-decoration: none; background: #ff6600; color: #ffffff; font-size: 20px; line-height: 26px;" href="/blogs/">Аналитика для профессионалов</a></td> |
||||
</tr> |
||||
<tr> |
||||
<td style="padding: 10px 30px 15px; background: #faf9f7;"> |
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="540"> |
||||
{% for item in blogs %} |
||||
|
||||
<tr valign="top"> |
||||
<td style="padding: 15px 15px 0 0; width: 76px;"> |
||||
<table cellpadding="0" cellspacing="0" border="0"> |
||||
<tr> |
||||
<td style="background: #ffffff; padding: 0; width: 76px; height: 76px; vertical-align: middle; text-align: center;"><a href="{{ item.get_permanent_url }}"><img style="width: 100%; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;" alt="" src="cid:mail_blogs_logo_{{ item.id }}" /></a></td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
<td style="padding: 15px 0 0;"> |
||||
|
||||
<h2 style="margin: 0 0 5px; font-family: Tahoma, Arial, sans-serif; font-size: 18px; line-height: 21px;"><a style="color: #464646; text-decoration: none;" href="{{ item.get_permanent_url }}">{{ item.main_title }}</a></h2> |
||||
<p style="margin: 0 0 7px; font-size: 13px; line-height: 17px;"><a style="color: #464646; text-decoration: none;" href="{{ item.get_permanent_url }}">{{ item.preview }} <span style="text-decoration: underline; color: #ff6600;">...</span></a></p> |
||||
|
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
|
||||
</table> |
||||
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
{% endif %} |
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; border-bottom: 1px dotted #cccccc;"> |
||||
<tr> |
||||
<td style="vertical-align: top; padding: 15px 0 10px;"> |
||||
<div class="logo"> |
||||
<a style="text-decoration: none; color: #a2a2a2; font-size: 12px;" href="/"> |
||||
<img src="cid:logo_2" alt="Expomap.ru" /> |
||||
</a> |
||||
</div> |
||||
</td> |
||||
<td style="vertical-align: top; padding: 25px 0 5px;"> |
||||
<ul class="t-links" style="margin: 0 0 15px; padding: 0; list-style: none; text-align: right; font-size: 14px; line-height: 15px; font-weight: bold;"> |
||||
<li style="display: inline-block;"><a style="text-decoration: none; color: #ff6600" href="/expo/">СОБЫТИЯ</a></li> |
||||
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="/places/">МЕСТА</a></li> |
||||
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="/members/">УЧАСТНИКИ</a></li> |
||||
</ul> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</body> |
||||
@ -1,8 +1,14 @@ |
||||
{% load i18n %} |
||||
<div id="unsubscription"> |
||||
<a name="unsubscription"></a> |
||||
<p> |
||||
{% trans "For unsubscribing to this mailing list," %} |
||||
<a href="{% if uidb36 and token %}http://{{ domain }}{% url 'newsletter_mailinglist_unsubscribe' slug=newsletter.slug uidb36=uidb36 token=token %}{% else %}#{% endif %}">{% trans "click here" %}</a>. |
||||
</p> |
||||
<table border="0" cellpadding="0" cellspacing="0" style="font-size: 12px; line-height: 15px; font-family: Arial, sans-serif; background: #f4f2ee;" width="100%" bgcolor="#f4f2ee" > |
||||
<tbody> |
||||
<tr> |
||||
<td style="vertical-align: top; padding: 15px 0 15px; text-align: center;">Чтобы отписаться от этой рассылки, перейдите <a href="{% if uidb36 and token %}http://{{ domain }}{% url 'newsletter_mailinglist_unsubscribe' slug=newsletter.slug uidb36=uidb36 token=token %}{% else %}#{% endif %}">по ссылке</a>. |
||||
<td style="vertical-align: top; padding: 15px 0 15px; color: #a2a2a2; text-align: left;">© 2018 — 2013 <a href="#" style="color: #a2a2a2; text-decoration: none;">Expomap.ru</a></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
|
||||
</div> |
||||
|
||||
|
||||
|
||||
Loading…
Reference in new issue