You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/emails.rst
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -305,3 +305,32 @@ Webhooks
305
305
--------
306
306
307
307
Mandrill provides notification system which notifies your URL endpoint that some message status was changed. For this purpose pymess provides view ``pymess.webhooks.mandrill.MandrillWebhookView`` which you simply add to your ``django urls``. Every notification will mark message to be updated with the ``pull_emails_info`` command.
308
+
309
+
310
+
Migrations
311
+
----------
312
+
313
+
The library provides utilities to migrate e-mail templates into database. The e-mail bodies can be stored in the files with path defined in the setting ``EMAIL_HTML_DATA_DIRECTORY``. Every file should be named its the template slug. You can use the ``pymess.utils.migrations.SyncEmailTemplates`` migration helper to sync e-mail body as in the example::
314
+
315
+
# Django settings
316
+
EMAIL_HTML_DATA_DIRECTORY = '/data/emails
317
+
318
+
# data/emails directory
319
+
data/emails
320
+
- set-pasword.html
321
+
- welcome.html
322
+
323
+
# Migration
324
+
from django.db import migrations
325
+
from pymess.utils.migrations import SyncEmailTemplates
326
+
327
+
328
+
class Migration(migrations.Migration):
329
+
330
+
dependencies = [
331
+
('communication', '0001_migration'),
332
+
]
333
+
334
+
operations = [
335
+
migrations.RunPython(SyncEmailTemplates(('set-password', 'welcome))), # Body of the e-mails will be updated (e-mail templates must exist in the database)
Name of the default SMS sender backend. The default value is ``default``.
79
+
80
+
.. attribute:: PYMESS_SMS_BACKEND_ROUTER
81
+
82
+
Path to the router class which select SMS backend name according to a recipient value. The default value is ``'pymess.backend.routers.DefaultBackendRouter'`` which returns None (None value means the default backend name should be set). You can implement custom router with::
83
+
84
+
# sms_routers.py file
85
+
from pymess.backend.routers import BaseRouter
86
+
87
+
class CustomRouter(BaseRouter):
88
+
89
+
def get_backend_name(self, recipient):
90
+
return 'admin' if recipient in ADMIN_PHONES else None
Name of the default E-mail sender backend. The default value is ``default``.
168
+
169
+
.. attribute:: PYMESS_EMAIL_BACKEND_ROUTER
170
+
171
+
Path to the router class which select e-mail backend name according to a recipient value. The default value is ``'pymess.backend.routers.DefaultBackendRouter'`` which returns None (None value means the default backend name should be set).
118
172
119
173
.. attribute:: PYMESS_EMAIL_BATCH_SENDING
120
174
@@ -145,6 +199,10 @@ E-MAIL
145
199
Path for storing e-mail attachments and contents (bodies).
146
200
If changed after initial migration, existing files must be moved manually via data migration.
147
201
202
+
.. attribute:: PYMESS_EMAIL_RETRY_SENDING
203
+
204
+
Setting defines if sending should be retried if fails. Works only together with batch sending. Default value is ``True``.
205
+
148
206
149
207
DIALER
150
208
^^^^^^
@@ -157,6 +215,24 @@ DIALER
157
215
158
216
Path to the dialer backend that will be used for sending dialer messages. Default value is ``'pymess.backend.dialer.dummy.DummyDialerBackend'``.
159
217
218
+
.. attribute:: PYMESS_DIALER_BACKENDS
219
+
220
+
Path to the dialer backends that will be used for sending dialer messages. The default value is::
Name of the default dialer sender backend. The default value is ``default``.
231
+
232
+
.. attribute:: PYMESS_DIALER_BACKEND_ROUTER
233
+
234
+
Path to the router class which select dialer backend name according to a recipient value. The default value is ``'pymess.backend.routers.DefaultBackendRouter'`` which returns None (None value means the default backend name should be set).
235
+
160
236
.. attribute:: PYMESS_DIALER_BATCH_SENDING
161
237
162
238
Because sending messages speed is dependent on the provider which can slow down your application speed, messages can be send in background with command ``send_messages_batch``. Default value is ``False``.
@@ -181,6 +257,10 @@ DIALER
181
257
182
258
Number of check attempts to get dialer message state. Default value is ``5``
183
259
260
+
.. attribute:: PYMESS_DIALER_RETRY_SENDING
261
+
262
+
Setting defines if sending should be retried if fails. Works only together with batch sending. Default value is ``True``.
263
+
184
264
185
265
Push notifications
186
266
^^^^^^^^^^^^^^^^^^
@@ -189,9 +269,23 @@ Push notifications
189
269
190
270
If you want to use your own push notification template model you must set this setting with your custom push notification template model that extends ``pymess.models.push.AbstractPushNotificationMessage`` otherwise is used ``pymess.models.push.PushNotificationMessage``.
Name of the default push notification sender backend. The default value is ``default``.
193
285
194
-
Path to the push notification backend that will be used for sending push notifications. Default value is ``'pymess.backend.push.dummy.DummyPushNotificationBackend'``.
Path to the router class which select push notification backend name according to a recipient value. The default value is ``'pymess.backend.routers.DefaultBackendRouter'`` which returns None (None value means the default backend name should be set).
Defines maximum number of seconds to try to send an push notification message that ended in an ``ERROR_RETRY`` state. Default value is ``60 * 60`` (1 hour).
0 commit comments