registration email with pictures

remotes/origin/1203
Назар Котюк 11 years ago
parent cdb96cf293
commit 9257d76b85
  1. 28
      proj/settings.py
  2. 2
      registration/backends/default/views.py
  3. 36
      registration/models.py
  4. BIN
      static/img/1.png
  5. BIN
      static/img/2.png
  6. BIN
      static/img/about_pic.png
  7. BIN
      static/img/add_link_text.png
  8. BIN
      static/img/add_pic_block_bg.png
  9. BIN
      static/img/add_pic_block_bg1.png
  10. BIN
      static/img/add_pic_block_bg2.png
  11. BIN
      static/img/ag-bg.png
  12. BIN
      static/img/ajax-loader.gif
  13. BIN
      static/img/approved-logo.png
  14. BIN
      static/img/blog_pic.jpg
  15. BIN
      static/img/blog_pic1.jpg
  16. BIN
      static/img/blog_pic2.jpg
  17. BIN
      static/img/clock.png
  18. BIN
      static/img/female.png
  19. BIN
      static/img/libk_bg.png
  20. BIN
      static/img/logo_reg.png
  21. BIN
      static/img/mail-logo-2.jpg
  22. BIN
      static/img/male.png
  23. BIN
      static/img/map.png
  24. BIN
      static/img/no-logo.jpg
  25. BIN
      static/img/no-logo.png
  26. BIN
      static/img/pic1.jpg
  27. BIN
      static/img/pic10.jpg
  28. BIN
      static/img/pic11.jpg
  29. BIN
      static/img/pic12.png
  30. BIN
      static/img/pic13.jpg
  31. BIN
      static/img/pic14.jpg
  32. BIN
      static/img/pic15.jpg
  33. BIN
      static/img/pic16.jpg
  34. BIN
      static/img/pic2.jpg
  35. BIN
      static/img/pic3.jpg
  36. BIN
      static/img/pic4.jpg
  37. BIN
      static/img/pic5.jpg
  38. BIN
      static/img/pic6.jpg
  39. BIN
      static/img/pic7.jpg
  40. BIN
      static/img/pic8.jpg
  41. BIN
      static/img/pic8.png
  42. BIN
      static/img/pic9.jpg
  43. BIN
      static/img/pin.png
  44. BIN
      static/img/search-bg.jpg
  45. BIN
      static/img/select.png
  46. BIN
      static/img/semitransparent-ie8.png
  47. BIN
      static/img/signature.png
  48. BIN
      static/img/soc-medias/icon-fb.png
  49. BIN
      static/img/soc-medias/icon-fb_hover.png
  50. BIN
      static/img/soc-medias/icon-goog.png
  51. BIN
      static/img/soc-medias/icon-lin.png
  52. BIN
      static/img/soc-medias/icon-lin_hover.png
  53. BIN
      static/img/soc-medias/icon-mailr.png
  54. BIN
      static/img/soc-medias/icon-ok.png
  55. BIN
      static/img/soc-medias/icon-twit.png
  56. BIN
      static/img/soc-medias/icon-vk.png
  57. BIN
      static/img/soc-medias/icon-yand.png
  58. BIN
      static/img/soc-medias/sm-icon-fb-w.png
  59. BIN
      static/img/soc-medias/sm-icon-fb.png
  60. BIN
      static/img/soc-medias/sm-icon-fb_hover.png
  61. BIN
      static/img/soc-medias/sm-icon-lin-w.png
  62. BIN
      static/img/soc-medias/sm-icon-lin.png
  63. BIN
      static/img/soc-medias/sm-icon-lin_hover.png
  64. BIN
      static/img/soc-medias/sm-icon-rss.png
  65. BIN
      static/img/soc-medias/sm-icon-twit-w.png
  66. BIN
      static/img/soc-medias/sm-icon-twit.png
  67. BIN
      static/img/soc-medias/sm-icon-twit_hover.png
  68. BIN
      static/img/soc-medias/sm-icon-vk-w.png
  69. BIN
      static/img/soc-medias/sm-icon-vk.png
  70. BIN
      static/img/soc-medias/sm-icon-vk_hover.png
  71. BIN
      static/img/soc.png
  72. BIN
      static/img/space.png
  73. BIN
      static/img/spacer.gif
  74. BIN
      static/img/sprites.png
  75. BIN
      static/img/subjects_list.png
  76. BIN
      static/img/wait.gif
  77. BIN
      static/img/wether.png
  78. BIN
      static/img/x2.png
  79. 114
      templates/registration/activation_email.html
  80. 6
      templates/registration/activation_email.txt

@ -223,21 +223,21 @@ LOGIN_URL='/'
#registration info
ACCOUNT_ACTIVATION_DAYS=2
# mail settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
EMAIL_PORT = 25
#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
#EMAIL_HOST = 'localhost'
#EMAIL_HOST_USER = ''
#EMAIL_HOST_PASSWORD = ''
#EMAIL_USE_TLS = False
#EMAIL_PORT = 25
#test
#EMAIL_USE_TLS = True
#EMAIL_HOST = 'smtp.gmail.com'
#EMAIL_HOST_USER = 'kotzilla'
#EMAIL_HOST_USER = 'kotzillla@gmail.com'
#EMAIL_HOST_PASSWORD = 'fitteR2006!'
#EMAIL_PORT = 587
#DEFAULT_FROM_EMAIL = 'kotzillla@gmail.com'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'kotzilla'
EMAIL_HOST_USER = 'kotzillla@gmail.com'
EMAIL_HOST_PASSWORD = 'fitteR2006!'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = 'kotzillla@gmail.com'
AUTHENTICATION_BACKENDS = (

@ -34,7 +34,7 @@ class RegistrationView(BaseRegistrationView):
* The creation of the templates
``registration/activation_email_subject.txt`` and
``registration/activation_email.txt``, which will be used for
``registration/activation_email.html``, which will be used for
the activation email. See the notes for this backends
``register`` method for details regarding these templates.

@ -2,13 +2,15 @@ import datetime
import hashlib
import random
import re
from django.core.mail import EmailMessage
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.template.loader import render_to_string, get_template
from django.template import Context
from django.utils.translation import ugettext_lazy as _
from email.MIMEImage import MIMEImage
try:
from django.contrib.auth import get_user_model
@ -232,7 +234,7 @@ class RegistrationProfile(models.Model):
text; output longer than one line will be forcibly joined
into only a single line.
``registration/activation_email.txt``
``registration/activation_email.html``
This template will be used for the body of the email.
These templates will each receive the following context
@ -256,15 +258,33 @@ class RegistrationProfile(models.Model):
framework for details regarding these objects' interfaces.
"""
user = self.user
ctx_dict = {'activation_key': self.activation_key,
'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
'site': site}
'site': site,
'user': user}
subject = render_to_string('registration/activation_email_subject.txt',
ctx_dict)
# Email subject *must not* contain newlines
subject = ''.join(subject.splitlines())
message = get_template('registration/activation_email.html').render(Context(ctx_dict))
msg = EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL, [user.email])
msg.content_subtype = "html"
images =(('/img/logo_reg.png', 'logo'),
('/img/soc-medias/sm-icon-rss.png', 'rss'),
('/img/soc-medias/sm-icon-fb.png', 'fb'),
('/img/soc-medias/sm-icon-lin.png', 'linkedin'),
('/img/soc-medias/sm-icon-vk.png', 'vk'),
('/img/soc-medias/sm-icon-twit.png', 'twit'),
('/img/mail-logo-2.jpg','logo2'))
for img in images:
fp = open(settings.STATIC_ROOT+img[0], 'rb')
msg_img = MIMEImage(fp.read())
fp.close()
msg_img.add_header('Content-ID', '<'+img[1]+'>')
msg.attach(msg_img)
msg.send()
message = render_to_string('registration/activation_email.txt',
ctx_dict)
self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
#self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

@ -0,0 +1,114 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html style="margin: 0; padding: 0; height: 100%;">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<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">
<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="#">СОБЫТИЯ</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">МЕСТА</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">УЧАСТНИКИ</a></li>
</ul>
<ul class="soc-media-buttons" style="margin: 0; padding: 0; list-style: none; text-align: right;">
<li style="display: inline-block;"><a href="#"><img src="cid:rss" title="RSS" alt="RSS" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:fb" title="Facebook" alt="Facebook" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:linkedin" title="LinkedIn" alt="LinkedIn" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:vk" title="В контакте" alt="В контакте" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:twit" title="Twitter" alt="Twitter" /></a></li>
</ul>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; margin-bottom: 10px;">
<tr>
<td style="padding: 20px 0 0;"><p style="display: block; padding: 25px 30px; text-decoration: none; background: #ff6600; color: #ffffff; font-size: 20px; line-height: 26px; margin-bottom: 0;" >Ваша регистрация на портале <a href="http://expomap.ru/" style="color: #ffffff;text-decoration: none;border-bottom: 1px dashed #ee3824;">Expomap</a></p></td>
</tr>
<tr>
<td style="padding: 10px 30px 15px; background: #faf9f7;">
<table cellpadding="0" cellspacing="0" border="0" width="540" style="margin-bottom: 15px;">
<tr valign="top">
<td style="padding: 15px 0 36px 0;">
<p style="font-weight: bold;color: #003e79;margin: 0;">Добрый день, {{ user.first_name }}!</p>
</td>
</tr>
<tr valign="top">
<td style="padding: 0 0 32px 0;">
<p>Благодарим за регистрацию! Остался 1 шаг - подтвердить Ваш электронный адрес, нажав на кнопку:</p>
</td>
</tr>
<tr valign="top">
<td style="padding: 0 0 42px 0; text-align: center;">
<a class="button" style="display: inline-block; padding: 4px 10px 3px; text-decoration: none; color: #2592c5; font-size: 14px; 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="http://{{ site }}/accounts/activate/{{ activation_key }}/">подтвердить регистрацию</a>
</td>
</tr>
<tr valign="top">
<td style="padding: 0 0 32px 0; text-align: left; border-bottom: 1px dotted #cccccc;">
<p style="margin: 0;">Ваш логин: {{ user.email }}</p>
</td>
</tr>
<tr valign="top">
<td style="padding:32px 0 20px 0; text-align: left;">
В личном кабинете вам доступен собственный профиль, персональная лента <span style="border-bottom: 1px dashed #ee3824;">событий</span>,свое расписание, сообщения и многое другое.
</td>
</tr>
</table>
</td>
</tr>
</table>
<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:logo2" 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="#">СОБЫТИЯ</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">МЕСТА</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">УЧАСТНИКИ</a></li>
</ul>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; font-size: 12px; line-height: 15px;">
<tr>
<td style="vertical-align: top; padding: 15px 0 15px; color: #a2a2a2; text-align: right;">
© 2018 — 2013 <a style="color: #a2a2a2; text-decoration: none;" href="#">Expomap.ru</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

@ -1,6 +0,0 @@
Someone, hopefully you, signed up for a new account at {{ site }} using this email address. If it was you, and you'd like to activate and use your account, click the link below or copy and paste it into your web browser's address bar:
http://{{ site }}/accounts/activate/{{ activation_key }}/
If you didn't request this, you don't need to do anything; you won't receive any more email from us, and the account will expire automatically in {{ expiration_days }} days.
Loading…
Cancel
Save