django-codenerix-email 4.0.27__py2.py3-none-any.whl → 4.0.29__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codenerix_email/__init__.py +1 -1
- codenerix_email/management/commands/__pycache__/test_email.cpython-310.pyc +0 -0
- codenerix_email/management/commands/test_email.py +19 -0
- codenerix_email/models.py +28 -4
- codenerix_email/views.py +17 -0
- {django_codenerix_email-4.0.27.dist-info → django_codenerix_email-4.0.29.dist-info}/METADATA +1 -1
- {django_codenerix_email-4.0.27.dist-info → django_codenerix_email-4.0.29.dist-info}/RECORD +10 -10
- {django_codenerix_email-4.0.27.dist-info → django_codenerix_email-4.0.29.dist-info}/LICENSE +0 -0
- {django_codenerix_email-4.0.27.dist-info → django_codenerix_email-4.0.29.dist-info}/WHEEL +0 -0
- {django_codenerix_email-4.0.27.dist-info → django_codenerix_email-4.0.29.dist-info}/top_level.txt +0 -0
codenerix_email/__init__.py
CHANGED
|
Binary file
|
|
@@ -22,6 +22,7 @@ import json
|
|
|
22
22
|
|
|
23
23
|
from django.core.management.base import BaseCommand
|
|
24
24
|
from django.conf import settings
|
|
25
|
+
from django.utils import timezone
|
|
25
26
|
|
|
26
27
|
from codenerix_lib.debugger import Debugger
|
|
27
28
|
from codenerix_email.models import EmailMessage, EmailTemplate # type: ignore
|
|
@@ -131,6 +132,15 @@ Django Codenerix Email v{}
|
|
|
131
132
|
email_message.efrom = settings.DEFAULT_FROM_EMAIL
|
|
132
133
|
email_message.eto = email
|
|
133
134
|
|
|
135
|
+
# Prepare message ID info
|
|
136
|
+
ecid = email_message.uuid.hex
|
|
137
|
+
edomain = settings.EMAIL_FROM.split("@")[-1]
|
|
138
|
+
ets = int(timezone.now().timestamp())
|
|
139
|
+
email_message.headers = {
|
|
140
|
+
"Message-ID": f"<{ecid}-{ets}@{edomain}>",
|
|
141
|
+
"X-Codenerix-Email": "Test",
|
|
142
|
+
}
|
|
143
|
+
|
|
134
144
|
if stdout:
|
|
135
145
|
self.debug(
|
|
136
146
|
f"Sending email to {name} <{email}> "
|
|
@@ -148,6 +158,15 @@ Django Codenerix Email v{}
|
|
|
148
158
|
email_message.efrom = settings.DEFAULT_FROM_EMAIL
|
|
149
159
|
email_message.eto = email
|
|
150
160
|
|
|
161
|
+
# Prepare message ID info
|
|
162
|
+
ecid = email_message.uuid.hex
|
|
163
|
+
edomain = settings.EMAIL_FROM.split("@")[-1]
|
|
164
|
+
ets = int(timezone.now().timestamp())
|
|
165
|
+
email_message.headers = {
|
|
166
|
+
"Message-ID": f"<{ecid}-{ets}@{edomain}>",
|
|
167
|
+
"X-Codenerix-Email": "Test",
|
|
168
|
+
}
|
|
169
|
+
|
|
151
170
|
if stdout:
|
|
152
171
|
self.debug(
|
|
153
172
|
f"Sending email to {name} <{email}> "
|
codenerix_email/models.py
CHANGED
|
@@ -49,8 +49,10 @@ CONTENT_SUBTYPES = (
|
|
|
49
49
|
)
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
def ensure_header(headers, key, value):
|
|
53
|
-
if
|
|
52
|
+
def ensure_header(headers, key, value, headers_keys=None):
|
|
53
|
+
if headers_keys is None:
|
|
54
|
+
headers_keys = [k.lower() for k in headers.keys()]
|
|
55
|
+
if key.lower() not in headers_keys:
|
|
54
56
|
headers[key] = value
|
|
55
57
|
return headers
|
|
56
58
|
|
|
@@ -186,13 +188,34 @@ class EmailMessage(CodenerixModel, Debugger):
|
|
|
186
188
|
# Get headers
|
|
187
189
|
headers = self.headers or {}
|
|
188
190
|
|
|
191
|
+
# Header keys
|
|
192
|
+
headers_keys = [k.lower() for k in headers.keys()]
|
|
193
|
+
|
|
189
194
|
# Ensure unsubscribe headers
|
|
190
195
|
if self.unsubscribe_url:
|
|
191
196
|
ensure_header(
|
|
192
|
-
headers,
|
|
197
|
+
headers,
|
|
198
|
+
"List-Unsubscribe",
|
|
199
|
+
f"<{self.unsubscribe_url}>",
|
|
200
|
+
headers_keys,
|
|
193
201
|
)
|
|
194
202
|
ensure_header(
|
|
195
|
-
headers,
|
|
203
|
+
headers,
|
|
204
|
+
"List-Unsubscribe-Post",
|
|
205
|
+
"List-Unsubscribe=One-Click",
|
|
206
|
+
headers_keys,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
# Prepare message ID info
|
|
210
|
+
if "Message-ID".lower() not in headers_keys:
|
|
211
|
+
ecid = self.uuid.hex
|
|
212
|
+
edomain = settings.EMAIL_FROM.split("@")[-1]
|
|
213
|
+
ets = int(timezone.now().timestamp())
|
|
214
|
+
ensure_header(
|
|
215
|
+
headers,
|
|
216
|
+
"Message-ID",
|
|
217
|
+
f"<{ecid}-{ets}@{edomain}>",
|
|
218
|
+
headers_keys,
|
|
196
219
|
)
|
|
197
220
|
|
|
198
221
|
# Return headers
|
|
@@ -552,6 +575,7 @@ class EmailTemplate(CodenerixModel):
|
|
|
552
575
|
e.body = Template(getattr(self, lang).body).render(Context(context))
|
|
553
576
|
e.efrom = Template(self.efrom).render(Context(context))
|
|
554
577
|
e.content_subtype = self.content_subtype
|
|
578
|
+
|
|
555
579
|
return e
|
|
556
580
|
|
|
557
581
|
def clean(self):
|
codenerix_email/views.py
CHANGED
|
@@ -115,6 +115,23 @@ class EmailTemplateList(GenList):
|
|
|
115
115
|
"bread": [_("Emails"), _("Email Template")],
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
def __fields__(self, info):
|
|
119
|
+
fields = []
|
|
120
|
+
fields.append(("pk", _("PK"), 100))
|
|
121
|
+
fields.append(("cid", _("CID"), 100))
|
|
122
|
+
fields.append(("efrom", _("From"), 100))
|
|
123
|
+
fields.append(
|
|
124
|
+
(
|
|
125
|
+
f"{self.language}__subject",
|
|
126
|
+
_("Subject"),
|
|
127
|
+
100,
|
|
128
|
+
None,
|
|
129
|
+
"shorttext:150",
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
fields.append(("content_subtype", _("Content Subtype"), 100))
|
|
133
|
+
return fields
|
|
134
|
+
|
|
118
135
|
|
|
119
136
|
class EmailTemplateCreate(MultiForm, GenCreate):
|
|
120
137
|
model = EmailTemplate
|
{django_codenerix_email-4.0.27.dist-info → django_codenerix_email-4.0.29.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-codenerix-email
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.29
|
|
4
4
|
Summary: Codenerix Email is a module that enables CODENERIX to set send emails in a general manner.
|
|
5
5
|
Home-page: https://github.com/codenerix/django-codenerix-email
|
|
6
6
|
Author: Juan Miguel Taboada Godoy <juanmi@juanmitaboada.com>, Juan Soler Ruiz <soleronline@gmail.com>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
codenerix_email/__init__.py,sha256=
|
|
1
|
+
codenerix_email/__init__.py,sha256=5rzSQbZ3vdKK0lyIWt_paXlWrp8v_bGPRDWv-165Bgw,149
|
|
2
2
|
codenerix_email/admin.py,sha256=o3b-MaD7xsWeta0yfU9YNeKBmHQIcmHqXmP2t-hrrWc,1208
|
|
3
3
|
codenerix_email/apps.py,sha256=WXqu1XQibDDyCvvQYt2JbTK4GIpW8BNv5DCbRJS2mmk,149
|
|
4
4
|
codenerix_email/forms.py,sha256=oVI58ZfDPr2aoA41xPS8yeU5H_JsYXwiEzWVMMnxM7A,4187
|
|
5
|
-
codenerix_email/models.py,sha256=
|
|
5
|
+
codenerix_email/models.py,sha256=KFm5rtco_rS2IVM9bfFwqyLT6TinQYKzSc9JZnoWr4A,21170
|
|
6
6
|
codenerix_email/urls.py,sha256=QYrSJdhCp2PLrcfv_Y7X4OzxqQ0Q2-z7ObDPE-_WLdw,2595
|
|
7
7
|
codenerix_email/urls_frontend.py,sha256=DG5WS_fGQJC9sezNebPwG-E_WtUWy3Kwz4VUxh82xuc,873
|
|
8
|
-
codenerix_email/views.py,sha256=
|
|
8
|
+
codenerix_email/views.py,sha256=qklrwpGNGNwStcmTs8goZ0j9TWp_gj0MVQas3ip1J98,5354
|
|
9
9
|
codenerix_email/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
codenerix_email/management/__pycache__/__init__.cpython-310.pyc,sha256=7vUcYbg6ZpWdEhb0hq2FSiwMtpBWIjMTv8H8rcgtiOY,179
|
|
11
11
|
codenerix_email/management/__pycache__/__init__.cpython-311.pyc,sha256=OtPcxwWjtJcDfDWQCWutxYIIwHerLtkPPyMcEFOpdMM,195
|
|
@@ -13,11 +13,11 @@ codenerix_email/management/__pycache__/__init__.cpython-35.pyc,sha256=sBoEWs6zdI
|
|
|
13
13
|
codenerix_email/management/__pycache__/__init__.cpython-39.pyc,sha256=uPXklfliVd3b8pLOJQT9ZeKcqmJMrGychvt68BsPulY,168
|
|
14
14
|
codenerix_email/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
codenerix_email/management/commands/send_emails.py,sha256=hotzGEkuDILwKgZgHFOaSCeAZDIyoPcM7VDs3Z-5Vvg,7950
|
|
16
|
-
codenerix_email/management/commands/test_email.py,sha256=
|
|
16
|
+
codenerix_email/management/commands/test_email.py,sha256=eAFdNrSq83SHKUjkXbbtfd5AtZjC5MZLbSfMH9F0Cbk,5633
|
|
17
17
|
codenerix_email/management/commands/__pycache__/__init__.cpython-310.pyc,sha256=3-VfdLuaiBIg4KTIy7GETYTt2-AbfCU0vlH6fFZx7_M,189
|
|
18
18
|
codenerix_email/management/commands/__pycache__/__init__.cpython-311.pyc,sha256=yiqmtIhQMYXWx7g7XT-mvQNgGu_X2ymasWvVxIqPsBE,211
|
|
19
19
|
codenerix_email/management/commands/__pycache__/send_emails.cpython-311.pyc,sha256=xh2ontFVtLWHZOoVf1YJrNbBNPtIyV2KQEk5Bf6mY_c,6884
|
|
20
|
-
codenerix_email/management/commands/__pycache__/test_email.cpython-310.pyc,sha256
|
|
20
|
+
codenerix_email/management/commands/__pycache__/test_email.cpython-310.pyc,sha256=5X7qBWFWs7AsNgTo1DyQE0zi5gtLxiFIcwdnboZIUSg,3154
|
|
21
21
|
codenerix_email/migrations/0001_initial.py,sha256=Rp6noz8vjtGi4f4qc2w_es_VV9PmO7WvVfv666mu9xE,3511
|
|
22
22
|
codenerix_email/migrations/0002_auto_20170502_1043.py,sha256=-zoc4RuZFXJA1Fw8ECCVqAg-PYfku3yxdtYNyXPI3LM,2369
|
|
23
23
|
codenerix_email/migrations/0003_auto_20170921_1206.py,sha256=ncVdyZJ616vQpllGdaPbFS0n9qKfDP-TuVA5HkbPf4I,656
|
|
@@ -81,8 +81,8 @@ codenerix_email/migrations/__pycache__/__init__.cpython-311.pyc,sha256=RbbUUEhcJ
|
|
|
81
81
|
codenerix_email/migrations/__pycache__/__init__.cpython-35.pyc,sha256=2g70xiMW6oJNkIpRM-0Dr5h7AUac-3xyCXPONxp9BBw,147
|
|
82
82
|
codenerix_email/migrations/__pycache__/__init__.cpython-39.pyc,sha256=qNj2NH0YvoWPnCKxkVZPsEFsbM05y7t1njMskNISdVQ,168
|
|
83
83
|
codenerix_email/static/codenerix_email/partials/emailmessages_rows.html,sha256=U0YDiFe-JaHri0VFv84jNbpbjgQXX0BVkg66FQybanw,2135
|
|
84
|
-
django_codenerix_email-4.0.
|
|
85
|
-
django_codenerix_email-4.0.
|
|
86
|
-
django_codenerix_email-4.0.
|
|
87
|
-
django_codenerix_email-4.0.
|
|
88
|
-
django_codenerix_email-4.0.
|
|
84
|
+
django_codenerix_email-4.0.29.dist-info/LICENSE,sha256=IXMIpi75XsrJt1Sznt4EftT9c_4X0C9eqK4tHhH8H48,11339
|
|
85
|
+
django_codenerix_email-4.0.29.dist-info/METADATA,sha256=BQixr9TQXZUZp8mpRWVTPTNWK_QdTGWSaq94jcgPUi8,2640
|
|
86
|
+
django_codenerix_email-4.0.29.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110
|
|
87
|
+
django_codenerix_email-4.0.29.dist-info/top_level.txt,sha256=lljSA0iKE_UBEM5gIrGQwioC_i8Jjnp-aR1LFElENgw,16
|
|
88
|
+
django_codenerix_email-4.0.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{django_codenerix_email-4.0.27.dist-info → django_codenerix_email-4.0.29.dist-info}/top_level.txt
RENAMED
|
File without changes
|