riso-django-db-mailer


Nameriso-django-db-mailer JSON
Version 2.4.2 PyPI version JSON
download
home_pagehttp://github.com/LPgenerator/django-db-mailer/
SummaryDjango module to easily send emails using django templates stored in a database.
upload_time2023-03-18 04:43:37
maintainer
docs_urlNone
authorGoTLiuM InSPiRiT
requires_python
license
keywords django db mail email html text tts sms push templates mailer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Django-Db-Mailer
================

.. image:: https://api.travis-ci.org/LPgenerator/django-db-mailer.png?branch=development
    :alt: Build Status
    :target: https://travis-ci.org/LPgenerator/django-db-mailer
.. image:: https://landscape.io/github/LPgenerator/django-db-mailer/master/landscape.svg
   :target: https://landscape.io/github/LPgenerator/django-db-mailer/master
   :alt: Code Health
.. image:: https://api.codacy.com/project/badge/grade/ad1442e15215494499ed08b80d4c41c5
    :target: https://www.codacy.com/app/gotlium/django-db-mailer
    :alt: Codacy
.. image:: https://img.shields.io/badge/python-2.7,3.4+,pypy,pypy3-blue.svg
    :alt: Python 2.7, 3.4+, pypy, pypy3
    :target: https://pypi.python.org/pypi/django-db-mailer/
.. image:: https://img.shields.io/pypi/v/django-db-mailer.svg
    :alt: Current version on PyPi
    :target: https://pypi.python.org/pypi/django-db-mailer/
.. image:: https://readthedocs.org/projects/django-db-mailer/badge/?version=latest
    :target: http://django-db-mailer.readthedocs.org/
    :alt: Documentation Status
.. image:: https://img.shields.io/badge/license-GPLv2-green.svg
    :target: https://pypi.python.org/pypi/django-db-mailer/
    :alt: License


Documentation available at `Read the Docs <http://django-db-mailer.readthedocs.org/>`_.


What's that
-----------
| Django module to easily send emails/push/sms/tts using django templates stored in a database.
| From box you can use it with django-celery for send background messages.
| Also you have opportunity to create reports from logs by mail categories and slug.
| Groups with Recipients and send by model signal also available by default.
| Can be used without any depends from programming language as a external service.
| That app very simple to install and use on your projects.


Installation
------------

1. Using pip:

.. code-block:: bash

    $ pip install django-db-mailer

2. Add the ``dbmail`` application to ``INSTALLED_APPS`` in your settings file (usually ``settings.py``)
3. Sync database (``./manage.py migrate``).


Mail API
--------

.. code-block:: python

    from dbmail.models import MailTemplate
    from dbmail import send_db_mail

    # New dbmail template
    MailTemplate.objects.create(
        name="Site welcome template",
        subject="[{{prefix}}] Welcome {{full_name}}!",
        message="Hi, {{username}}. Welcome to our site.",
        slug="welcome",
        is_html=False,
    )

    # Send message with created template
    send_db_mail(
        # slug which defined on db template
        slug='welcome',

        # recipient can be list, or str separated with comma or simple string
        # 'user1@example.com' or 'user1@example.com, user2@example.com' or
        # ['user1@example.com', 'user2@example.com'] or string Mail group slug
        recipient='user1@example.com',

        # All *args params will be accessible on template context
        {
            'username': request.user.username,
            'full_name': request.user.get_full_name(),
            'signup_date': request.user.date_joined,
            'prefix': "DbMail",
        },

        # You can access to all model fields. For m2m and fk fields, you should use module_name
        MyModel.objects.get(pk=1),

        # Optional kwargs:
        # backend='dbmail.backends.mail',
        # provider='apps.utils.some.mail.provider',
        # from_email='from@example.com'
        # cc=['cc@example.com'],
        # bcc=['bcc@example.com'],
        # user=User.objects.get(pk=1),
        #
        # language='ru',
        #
        # attachments=[(filename, content, mimetype)],
        # files=['hello.jpg', 'world.png'],
        # headers={'Custom-Header':'Some value'},
        #
        # queue='default',
        # retry_delay=300,
        # max_retries=3,
        # retry=True,
        # time_limit=30,
        # send_after=60,
        #
        # use_celery=True,
    )


Sms API
-------

.. code-block:: python

    from dbmail import send_db_sms


    send_db_sms(
        # slug which defined on db template
        slug='welcome',

        # recipient can be list, or str separated with comma or simple string
        # '+79031234567' or +79031234567, +79031234568, +79031234569' or
        # ['+79031234567', '+79031234568'] or string Mail group slug
        recipient='+79031234567',

        # All *args params will be accessible on template context
        {
            'username': request.user.username,
            'full_name': request.user.get_full_name(),
            'signup_date': request.user.date_joined
        },

        # You can access to all model fields. For m2m and fk fields, you should use module_name
        MyModel.objects.get(pk=1),

        # Optional kwargs:
        # backend='dbmail.backends.sms',
        # provider='dbmail.providers.nexmo.sms',
        # from_email='DBMail'
        # user=User.objects.get(pk=1),
        #
        # language='ru',
        #
        # queue='default',
        # retry_delay=300,
        # max_retries=3,
        # retry=True,
        # time_limit=30,
        # send_after=60,
        #
        # use_celery=True,
    )



Text to speech API
------------------

.. code-block:: python

    from dbmail import send_db_tts


    send_db_tts(
        # slug which defined on db template
        slug='welcome',

        # recipient can be list, or str separated with comma or simple string
        # '+79031234567' or +79031234567, +79031234568, +79031234569' or
        # ['+79031234567', '+79031234568'] or string Mail group slug
        recipient='+79031234567',

        # All *args params will be accessible on template context
        {
            'username': request.user.username,
            'full_name': request.user.get_full_name(),
            'signup_date': request.user.date_joined
        },

        # You can access to all model fields. For m2m and fk fields, you should use module_name
        MyModel.objects.get(pk=1),

        # Optional kwargs:
        # backend='dbmail.backends.tts',
        # provider='dbmail.providers.nexmo.tts',
        # from_email='DBMail'
        # user=User.objects.get(pk=1),
        #
        # language='ru',
        #
        # queue='default',
        # retry_delay=300,
        # max_retries=3,
        # retry=True,
        # time_limit=30,
        # send_after=60,
        #
        # use_celery=True,
    )


*Text to speech supported by default provider. But maybe not supported by your provider.*


Push notification API
---------------------

.. code-block:: python

    from dbmail import send_db_push


    send_db_push(
        # slug which defined on db template
        slug='welcome',

        # recipient can be list, or str separated with comma or simple string
        # '34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8a' or '34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8a, 34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8b' or
        # ['34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8a', '34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8b'] or string Mail group slug
        recipient='34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8c',

        # All *args params will be accessible on template context
        {
            'username': request.user.username,
            'full_name': request.user.get_full_name(),
            'signup_date': request.user.date_joined
        },

        # You can access to all model fields. For m2m and fk fields, you should use module_name
        MyModel.objects.get(pk=1),

        # Optional kwargs:
        # backend='dbmail.backends.push',
        # provider='dbmail.providers.prowl.push',
        # event='Server is down!',
        # from_email='ConsoleApp'
        # user=User.objects.get(pk=1),
        #
        # language='ru',
        #
        # queue='default',
        # retry_delay=300,
        # max_retries=3,
        # retry=True,
        # time_limit=30,
        # send_after=60,
        #
        # use_celery=True,
    )


DBMail Backends
---------------
By default ``django-dbmail`` used 4 built-in backends (Mail/Sms/Tts/Push).
But nothing prevents to write your own backend to work with all that you want.


DBMail Providers
----------------
Battery have some built-in providers for most popular services, which will be
used without any dependencies with built-in backends.

**Push notifications for mobile apps:**

* Apple APNs/APNs2
* Google GCM
* Microsoft Tile/Toast/Raw
* BoxCar
* Parse

**Browser notifications:**

* GCM (Desktop: Google Chrome, FireFox; Mobile: Google Chrome on Android)
* APNs (Desktop: Safari)
* Centrifugo
* PubNub
* BoxCar
* PushAll

**Notifications for team:**

* Slack/Mattermost
* Boxcar
* Prowl
* Pushover
* PushAll

**SMS notifications:**

* Nexmo
* Twilio
* IQsms
* SmsAero
* SmsBliss

**Mail notifications:**

* SendinBlue
* Any, which designed as django email backend

*You can find providers settings on docs.*


Demo installation
-----------------

**Docker**

.. code-block:: bash

    $ git clone --depth 1 -b master https://github.com/LPgenerator/django-db-mailer.git db-mailer
    $ cd db-mailer
    $ docker build -t dbmail .
    $ docker run -it -d -p 8000:8000 --name dbmail dbmail
    $ docker exec -i -t dbmail /bin/bash
    $ cd /mailer/

**Vagrant**

.. code-block:: bash

    $ git clone --depth 1 -b master https://github.com/LPgenerator/django-db-mailer.git db-mailer
    $ cd db-mailer
    $ vagrant up --provider virtualbox
    $ vagrant ssh
    $ cd /mailer/


**OS X/Linux**


.. code-block:: bash

    $ sudo apt-get install -y virtualenvwrapper redis-server git python-dev libxml2-dev libxslt-dev zlib1g-dev || brew install pyenv-virtualenvwrapper redis git
    $ source /usr/share/virtualenvwrapper/virtualenvwrapper.sh || source /usr/local/bin/virtualenvwrapper.sh
    $ mkvirtualenv db-mailer
    $ workon db-mailer
    $ git clone --depth 1 https://github.com/LPgenerator/django-db-mailer.git db-mailer
    $ cd db-mailer
    $ python setup.py develop
    $ cd demo
    $ pip install -r requirements.txt
    $ python manage.py migrate --noinput
    $ python manage.py createsuperuser --username admin --email admin@local.host
    $ redis-server >& /dev/null &
    $ python manage.py runserver >& /dev/null &
    $ python manage.py celeryd -Q default >& /dev/null &


Open Shell:

.. code-block:: bash

    $ python manage.py shell_plus --print-sql


Create new template:

.. code-block:: python

    from dbmail.models import MailTemplate
    from dbmail import send_db_mail

    MailTemplate.objects.create(
        name="Site welcome template",
        subject="Welcome",
        message="Welcome to our site. We are glad to see you.",
        slug="welcome",
        is_html=False,
    )


Try to send test email with created template (without celery):

.. code-block:: python

    send_db_mail('welcome', 'user@example.com', use_celery=False)


Send email using celery:

.. code-block:: python

    send_db_mail('welcome', 'user@example.com')


Check mail logs:

.. code-block:: python

    from pprint import pprint
    from django.forms.models import model_to_dict
    from dbmail.models import MailLog

    pprint([model_to_dict(obj) for obj in MailLog.objects.all()])


Open app in browser (login and password is admin/admin):

.. code-block:: bash

    $ xdg-open http://127.0.0.1:8000/admin/dbmail/ >& /dev/null || open http://127.0.0.1:8000/admin/dbmail/ >& /dev/null


Additional information
----------------------

**Revision**

For support template reversion, you can install ``django-reversion``.
Find information about compatibility with your Django versions `here_1 <http://django-reversion.readthedocs.org/en/latest/django-versions.html>`_.

**Editor**

To enable editor, you may install and configure ``django-tinymce`` or ``django-ckeditor`` app.

**Theme**

``django-db-mailer`` supported from box ``django-grappelli`` and ``django-suit`` skin. Information about compatibility available `here_2 <https://pypi.python.org/pypi/django-grappelli/2.5.3>`_.

**Queue**

Install and configure ``django-celery`` for background message sending with priorities. You can find celery settings examples on demo project.
We recommended to use ``django-celery-mon`` with ``django-celery`` for monitoring celery and supervisor processes.

**Premailer**

For turns CSS blocks into style attributes, you can install ``premailer`` from PyPi.

**Translation**

For use different language on your mail templates, install ``django-modeltranslation`` or ``grappelli-modeltranslation``.
Add into settings.py:

.. code-block:: python

    MODELTRANSLATION_DEFAULT_LANGUAGE = 'en'
    MODELTRANSLATION_LANGUAGES = ('ru', 'en')
    MODELTRANSLATION_TRANSLATION_FILES = (
        'dbmail.translation',
    )
    INSTALLED_APPS = ('modeltranslation',) + INSTALLED_APPS
    # INSTALLED_APPS = ('grappelli', 'grappelli_modeltranslation', 'modeltranslation',) + INSTALLED_APPS


Update dbmail fields:

.. code-block:: bash

    $ ./manage.py sync_translation_fields --noinput

**Postmark Django Backend**

Install ``python-postmark`` app via pip. Configure your settings:

.. code-block:: python

    POSTMARK_API_KEY = ''
    POSTMARK_SENDER = 'noreply@example.com'
    POSTMARK_TEST_MODE = False
    EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'


**Amazon's Simple Email Service Django Backend**

Install ``django-ses`` app via pip. Configure your settings:

.. code-block:: python

    EMAIL_BACKEND = 'django_ses.SESBackend'

    # These are optional -- if they're set as environment variables they won't
    # need to be set here as well
    AWS_ACCESS_KEY_ID = 'YOUR-ACCESS-KEY-ID'
    AWS_SECRET_ACCESS_KEY = 'YOUR-SECRET-ACCESS-KEY'

    # Additionally, you can specify an optional region, like so:
    AWS_SES_REGION_NAME = 'us-east-1'
    AWS_SES_REGION_ENDPOINT = 'email.us-east-1.amazonaws.com'


*Note: You can use any backends designed as django email backend*

**Tracking**

.. code-block:: bash

    $ pip install httpagentparser django-ipware geoip2

For track information about user, or about mail is read, you must be enable logging, and enable tracking on settings.

If you use Django 1.8, you should install `geoip` package instead of `geoip2`.

**MJML**

MJML is a markup language designed to reduce the pain of coding a responsive email.
Install ``django-mjml`` app via pip and ``mjml`` via npm. And configure your settings:

.. code-block:: python

    INSTALLED_APPS = (
      ...,
      'mjml',
    )


**Older versions**

Very simple version of this app, available `here_3 <https://github.com/LPgenerator/django-db-mailer/tree/1.0>`_.
That version do not include celery settings, bcc, api, mail settings, signals, mail groups and model browser.


**Notes**

All app features available only with ``django-celery`` and with ``Redis``.

.. code-block:: bash

    $ pip install redis hiredis django-celery



External API usage
------------------

.. code-block:: python

    from dbmail.models import ApiKey

    ApiKey.objects.create(name='Test', api_key='ZzriUzE')


.. code-block:: bash

    $ pip install httpie
    $ http -f POST http://127.0.0.1:8000/dbmail/api/ api_key=ZzriUzE slug=welcome recipient=root@local.host data='{"name": "Ivan", "age": 20}'
        or
    $ apt-get install curl || brew install curl
    $ curl -X POST http://127.0.0.1:8000/dbmail/api/ --data 'api_key=ZzriUzE&slug=welcome&recipient=root@local.host&backend=mail'

*API bandwidth is 1k+ rps on i7 2.3GHz*


Responsive transactional HTML email templates
---------------------------------------------
Fixtures with Base transactional HTML email templates was added into dbmail fixtures.
This templates was optimized for desktop clients, web clients, mobile clients, various devices, various providers.
Thanks for Mailgun Team. You can use it as default basic templates on your project.

.. code-block:: bash

    python manage.py load_dbmail_base_templates



Publications
------------
* `Установка и использование с примерами на русском <http://habrahabr.ru/post/253445/>`_.
* `Completely installation and usage with examples. Translated by Google <http://translate.google.com/translate?hl=en&sl=ru&tl=en&u=http://habrahabr.ru/post/253445/>`_.


Screenshots
-----------

.. image:: /screenshots/template_edit.jpg
.. image:: /screenshots/templates_changelist.jpg
.. image:: /screenshots/template_log_changelist.jpg
.. image:: /screenshots/template_log_view.jpg
.. image:: /screenshots/group_change.jpg
.. image:: /screenshots/signal_edit.jpg
.. image:: /screenshots/signals_changelist.jpg
.. image:: /screenshots/apps_view.jpg
.. image:: /screenshots/apps_browse_vars.jpg
.. image:: /screenshots/smtp_changelist.jpg
.. image:: /screenshots/apikey_changelist.jpg
.. image:: /screenshots/bcc_changelist.jpg
.. image:: /screenshots/template_compare.jpg
.. image:: /screenshots/tracking_edit.jpg
.. image:: /screenshots/base_template_changelist.jpg
.. image:: /screenshots/subscriptions_change.jpg
.. image:: /screenshots/subscriptions_changelist.jpg


Compatibility
-------------
* Python: 2.7, pypy2.7, 3.4, 3.5, 3.6, 3.7, pypy3.5
* Django: 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/LPgenerator/django-db-mailer/",
    "name": "riso-django-db-mailer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django db mail email html text tts sms push templates mailer",
    "author": "GoTLiuM InSPiRiT",
    "author_email": "gotlium@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/67/6d/f4f1fda60c10b04bdfd82223c374242e33e313c379f5b5b0041c01939030/riso-django-db-mailer-2.4.2.tar.gz",
    "platform": null,
    "description": "Django-Db-Mailer\n================\n\n.. image:: https://api.travis-ci.org/LPgenerator/django-db-mailer.png?branch=development\n    :alt: Build Status\n    :target: https://travis-ci.org/LPgenerator/django-db-mailer\n.. image:: https://landscape.io/github/LPgenerator/django-db-mailer/master/landscape.svg\n   :target: https://landscape.io/github/LPgenerator/django-db-mailer/master\n   :alt: Code Health\n.. image:: https://api.codacy.com/project/badge/grade/ad1442e15215494499ed08b80d4c41c5\n    :target: https://www.codacy.com/app/gotlium/django-db-mailer\n    :alt: Codacy\n.. image:: https://img.shields.io/badge/python-2.7,3.4+,pypy,pypy3-blue.svg\n    :alt: Python 2.7, 3.4+, pypy, pypy3\n    :target: https://pypi.python.org/pypi/django-db-mailer/\n.. image:: https://img.shields.io/pypi/v/django-db-mailer.svg\n    :alt: Current version on PyPi\n    :target: https://pypi.python.org/pypi/django-db-mailer/\n.. image:: https://readthedocs.org/projects/django-db-mailer/badge/?version=latest\n    :target: http://django-db-mailer.readthedocs.org/\n    :alt: Documentation Status\n.. image:: https://img.shields.io/badge/license-GPLv2-green.svg\n    :target: https://pypi.python.org/pypi/django-db-mailer/\n    :alt: License\n\n\nDocumentation available at `Read the Docs <http://django-db-mailer.readthedocs.org/>`_.\n\n\nWhat's that\n-----------\n| Django module to easily send emails/push/sms/tts using django templates stored in a database.\n| From box you can use it with django-celery for send background messages.\n| Also you have opportunity to create reports from logs by mail categories and slug.\n| Groups with Recipients and send by model signal also available by default.\n| Can be used without any depends from programming language as a external service.\n| That app very simple to install and use on your projects.\n\n\nInstallation\n------------\n\n1. Using pip:\n\n.. code-block:: bash\n\n    $ pip install django-db-mailer\n\n2. Add the ``dbmail`` application to ``INSTALLED_APPS`` in your settings file (usually ``settings.py``)\n3. Sync database (``./manage.py migrate``).\n\n\nMail API\n--------\n\n.. code-block:: python\n\n    from dbmail.models import MailTemplate\n    from dbmail import send_db_mail\n\n    # New dbmail template\n    MailTemplate.objects.create(\n        name=\"Site welcome template\",\n        subject=\"[{{prefix}}] Welcome {{full_name}}!\",\n        message=\"Hi, {{username}}. Welcome to our site.\",\n        slug=\"welcome\",\n        is_html=False,\n    )\n\n    # Send message with created template\n    send_db_mail(\n        # slug which defined on db template\n        slug='welcome',\n\n        # recipient can be list, or str separated with comma or simple string\n        # 'user1@example.com' or 'user1@example.com, user2@example.com' or\n        # ['user1@example.com', 'user2@example.com'] or string Mail group slug\n        recipient='user1@example.com',\n\n        # All *args params will be accessible on template context\n        {\n            'username': request.user.username,\n            'full_name': request.user.get_full_name(),\n            'signup_date': request.user.date_joined,\n            'prefix': \"DbMail\",\n        },\n\n        # You can access to all model fields. For m2m and fk fields, you should use module_name\n        MyModel.objects.get(pk=1),\n\n        # Optional kwargs:\n        # backend='dbmail.backends.mail',\n        # provider='apps.utils.some.mail.provider',\n        # from_email='from@example.com'\n        # cc=['cc@example.com'],\n        # bcc=['bcc@example.com'],\n        # user=User.objects.get(pk=1),\n        #\n        # language='ru',\n        #\n        # attachments=[(filename, content, mimetype)],\n        # files=['hello.jpg', 'world.png'],\n        # headers={'Custom-Header':'Some value'},\n        #\n        # queue='default',\n        # retry_delay=300,\n        # max_retries=3,\n        # retry=True,\n        # time_limit=30,\n        # send_after=60,\n        #\n        # use_celery=True,\n    )\n\n\nSms API\n-------\n\n.. code-block:: python\n\n    from dbmail import send_db_sms\n\n\n    send_db_sms(\n        # slug which defined on db template\n        slug='welcome',\n\n        # recipient can be list, or str separated with comma or simple string\n        # '+79031234567' or +79031234567, +79031234568, +79031234569' or\n        # ['+79031234567', '+79031234568'] or string Mail group slug\n        recipient='+79031234567',\n\n        # All *args params will be accessible on template context\n        {\n            'username': request.user.username,\n            'full_name': request.user.get_full_name(),\n            'signup_date': request.user.date_joined\n        },\n\n        # You can access to all model fields. For m2m and fk fields, you should use module_name\n        MyModel.objects.get(pk=1),\n\n        # Optional kwargs:\n        # backend='dbmail.backends.sms',\n        # provider='dbmail.providers.nexmo.sms',\n        # from_email='DBMail'\n        # user=User.objects.get(pk=1),\n        #\n        # language='ru',\n        #\n        # queue='default',\n        # retry_delay=300,\n        # max_retries=3,\n        # retry=True,\n        # time_limit=30,\n        # send_after=60,\n        #\n        # use_celery=True,\n    )\n\n\n\nText to speech API\n------------------\n\n.. code-block:: python\n\n    from dbmail import send_db_tts\n\n\n    send_db_tts(\n        # slug which defined on db template\n        slug='welcome',\n\n        # recipient can be list, or str separated with comma or simple string\n        # '+79031234567' or +79031234567, +79031234568, +79031234569' or\n        # ['+79031234567', '+79031234568'] or string Mail group slug\n        recipient='+79031234567',\n\n        # All *args params will be accessible on template context\n        {\n            'username': request.user.username,\n            'full_name': request.user.get_full_name(),\n            'signup_date': request.user.date_joined\n        },\n\n        # You can access to all model fields. For m2m and fk fields, you should use module_name\n        MyModel.objects.get(pk=1),\n\n        # Optional kwargs:\n        # backend='dbmail.backends.tts',\n        # provider='dbmail.providers.nexmo.tts',\n        # from_email='DBMail'\n        # user=User.objects.get(pk=1),\n        #\n        # language='ru',\n        #\n        # queue='default',\n        # retry_delay=300,\n        # max_retries=3,\n        # retry=True,\n        # time_limit=30,\n        # send_after=60,\n        #\n        # use_celery=True,\n    )\n\n\n*Text to speech supported by default provider. But maybe not supported by your provider.*\n\n\nPush notification API\n---------------------\n\n.. code-block:: python\n\n    from dbmail import send_db_push\n\n\n    send_db_push(\n        # slug which defined on db template\n        slug='welcome',\n\n        # recipient can be list, or str separated with comma or simple string\n        # '34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8a' or '34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8a, 34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8b' or\n        # ['34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8a', '34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8b'] or string Mail group slug\n        recipient='34cc3e5f0d2abf2ca0f9af170bd8cd2372a22f8c',\n\n        # All *args params will be accessible on template context\n        {\n            'username': request.user.username,\n            'full_name': request.user.get_full_name(),\n            'signup_date': request.user.date_joined\n        },\n\n        # You can access to all model fields. For m2m and fk fields, you should use module_name\n        MyModel.objects.get(pk=1),\n\n        # Optional kwargs:\n        # backend='dbmail.backends.push',\n        # provider='dbmail.providers.prowl.push',\n        # event='Server is down!',\n        # from_email='ConsoleApp'\n        # user=User.objects.get(pk=1),\n        #\n        # language='ru',\n        #\n        # queue='default',\n        # retry_delay=300,\n        # max_retries=3,\n        # retry=True,\n        # time_limit=30,\n        # send_after=60,\n        #\n        # use_celery=True,\n    )\n\n\nDBMail Backends\n---------------\nBy default ``django-dbmail`` used 4 built-in backends (Mail/Sms/Tts/Push).\nBut nothing prevents to write your own backend to work with all that you want.\n\n\nDBMail Providers\n----------------\nBattery have some built-in providers for most popular services, which will be\nused without any dependencies with built-in backends.\n\n**Push notifications for mobile apps:**\n\n* Apple APNs/APNs2\n* Google GCM\n* Microsoft Tile/Toast/Raw\n* BoxCar\n* Parse\n\n**Browser notifications:**\n\n* GCM (Desktop: Google Chrome, FireFox; Mobile: Google Chrome on Android)\n* APNs (Desktop: Safari)\n* Centrifugo\n* PubNub\n* BoxCar\n* PushAll\n\n**Notifications for team:**\n\n* Slack/Mattermost\n* Boxcar\n* Prowl\n* Pushover\n* PushAll\n\n**SMS notifications:**\n\n* Nexmo\n* Twilio\n* IQsms\n* SmsAero\n* SmsBliss\n\n**Mail notifications:**\n\n* SendinBlue\n* Any, which designed as django email backend\n\n*You can find providers settings on docs.*\n\n\nDemo installation\n-----------------\n\n**Docker**\n\n.. code-block:: bash\n\n    $ git clone --depth 1 -b master https://github.com/LPgenerator/django-db-mailer.git db-mailer\n    $ cd db-mailer\n    $ docker build -t dbmail .\n    $ docker run -it -d -p 8000:8000 --name dbmail dbmail\n    $ docker exec -i -t dbmail /bin/bash\n    $ cd /mailer/\n\n**Vagrant**\n\n.. code-block:: bash\n\n    $ git clone --depth 1 -b master https://github.com/LPgenerator/django-db-mailer.git db-mailer\n    $ cd db-mailer\n    $ vagrant up --provider virtualbox\n    $ vagrant ssh\n    $ cd /mailer/\n\n\n**OS X/Linux**\n\n\n.. code-block:: bash\n\n    $ sudo apt-get install -y virtualenvwrapper redis-server git python-dev libxml2-dev libxslt-dev zlib1g-dev || brew install pyenv-virtualenvwrapper redis git\n    $ source /usr/share/virtualenvwrapper/virtualenvwrapper.sh || source /usr/local/bin/virtualenvwrapper.sh\n    $ mkvirtualenv db-mailer\n    $ workon db-mailer\n    $ git clone --depth 1 https://github.com/LPgenerator/django-db-mailer.git db-mailer\n    $ cd db-mailer\n    $ python setup.py develop\n    $ cd demo\n    $ pip install -r requirements.txt\n    $ python manage.py migrate --noinput\n    $ python manage.py createsuperuser --username admin --email admin@local.host\n    $ redis-server >& /dev/null &\n    $ python manage.py runserver >& /dev/null &\n    $ python manage.py celeryd -Q default >& /dev/null &\n\n\nOpen Shell:\n\n.. code-block:: bash\n\n    $ python manage.py shell_plus --print-sql\n\n\nCreate new template:\n\n.. code-block:: python\n\n    from dbmail.models import MailTemplate\n    from dbmail import send_db_mail\n\n    MailTemplate.objects.create(\n        name=\"Site welcome template\",\n        subject=\"Welcome\",\n        message=\"Welcome to our site. We are glad to see you.\",\n        slug=\"welcome\",\n        is_html=False,\n    )\n\n\nTry to send test email with created template (without celery):\n\n.. code-block:: python\n\n    send_db_mail('welcome', 'user@example.com', use_celery=False)\n\n\nSend email using celery:\n\n.. code-block:: python\n\n    send_db_mail('welcome', 'user@example.com')\n\n\nCheck mail logs:\n\n.. code-block:: python\n\n    from pprint import pprint\n    from django.forms.models import model_to_dict\n    from dbmail.models import MailLog\n\n    pprint([model_to_dict(obj) for obj in MailLog.objects.all()])\n\n\nOpen app in browser (login and password is admin/admin):\n\n.. code-block:: bash\n\n    $ xdg-open http://127.0.0.1:8000/admin/dbmail/ >& /dev/null || open http://127.0.0.1:8000/admin/dbmail/ >& /dev/null\n\n\nAdditional information\n----------------------\n\n**Revision**\n\nFor support template reversion, you can install ``django-reversion``.\nFind information about compatibility with your Django versions `here_1 <http://django-reversion.readthedocs.org/en/latest/django-versions.html>`_.\n\n**Editor**\n\nTo enable editor, you may install and configure ``django-tinymce`` or ``django-ckeditor`` app.\n\n**Theme**\n\n``django-db-mailer`` supported from box ``django-grappelli`` and ``django-suit`` skin. Information about compatibility available `here_2 <https://pypi.python.org/pypi/django-grappelli/2.5.3>`_.\n\n**Queue**\n\nInstall and configure ``django-celery`` for background message sending with priorities. You can find celery settings examples on demo project.\nWe recommended to use ``django-celery-mon`` with ``django-celery`` for monitoring celery and supervisor processes.\n\n**Premailer**\n\nFor turns CSS blocks into style attributes, you can install ``premailer`` from PyPi.\n\n**Translation**\n\nFor use different language on your mail templates, install ``django-modeltranslation`` or ``grappelli-modeltranslation``.\nAdd into settings.py:\n\n.. code-block:: python\n\n    MODELTRANSLATION_DEFAULT_LANGUAGE = 'en'\n    MODELTRANSLATION_LANGUAGES = ('ru', 'en')\n    MODELTRANSLATION_TRANSLATION_FILES = (\n        'dbmail.translation',\n    )\n    INSTALLED_APPS = ('modeltranslation',) + INSTALLED_APPS\n    # INSTALLED_APPS = ('grappelli', 'grappelli_modeltranslation', 'modeltranslation',) + INSTALLED_APPS\n\n\nUpdate dbmail fields:\n\n.. code-block:: bash\n\n    $ ./manage.py sync_translation_fields --noinput\n\n**Postmark Django Backend**\n\nInstall ``python-postmark`` app via pip. Configure your settings:\n\n.. code-block:: python\n\n    POSTMARK_API_KEY = ''\n    POSTMARK_SENDER = 'noreply@example.com'\n    POSTMARK_TEST_MODE = False\n    EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'\n\n\n**Amazon's Simple Email Service Django Backend**\n\nInstall ``django-ses`` app via pip. Configure your settings:\n\n.. code-block:: python\n\n    EMAIL_BACKEND = 'django_ses.SESBackend'\n\n    # These are optional -- if they're set as environment variables they won't\n    # need to be set here as well\n    AWS_ACCESS_KEY_ID = 'YOUR-ACCESS-KEY-ID'\n    AWS_SECRET_ACCESS_KEY = 'YOUR-SECRET-ACCESS-KEY'\n\n    # Additionally, you can specify an optional region, like so:\n    AWS_SES_REGION_NAME = 'us-east-1'\n    AWS_SES_REGION_ENDPOINT = 'email.us-east-1.amazonaws.com'\n\n\n*Note: You can use any backends designed as django email backend*\n\n**Tracking**\n\n.. code-block:: bash\n\n    $ pip install httpagentparser django-ipware geoip2\n\nFor track information about user, or about mail is read, you must be enable logging, and enable tracking on settings.\n\nIf you use Django 1.8, you should install `geoip` package instead of `geoip2`.\n\n**MJML**\n\nMJML is a markup language designed to reduce the pain of coding a responsive email.\nInstall ``django-mjml`` app via pip and ``mjml`` via npm. And configure your settings:\n\n.. code-block:: python\n\n    INSTALLED_APPS = (\n      ...,\n      'mjml',\n    )\n\n\n**Older versions**\n\nVery simple version of this app, available `here_3 <https://github.com/LPgenerator/django-db-mailer/tree/1.0>`_.\nThat version do not include celery settings, bcc, api, mail settings, signals, mail groups and model browser.\n\n\n**Notes**\n\nAll app features available only with ``django-celery`` and with ``Redis``.\n\n.. code-block:: bash\n\n    $ pip install redis hiredis django-celery\n\n\n\nExternal API usage\n------------------\n\n.. code-block:: python\n\n    from dbmail.models import ApiKey\n\n    ApiKey.objects.create(name='Test', api_key='ZzriUzE')\n\n\n.. code-block:: bash\n\n    $ pip install httpie\n    $ http -f POST http://127.0.0.1:8000/dbmail/api/ api_key=ZzriUzE slug=welcome recipient=root@local.host data='{\"name\": \"Ivan\", \"age\": 20}'\n        or\n    $ apt-get install curl || brew install curl\n    $ curl -X POST http://127.0.0.1:8000/dbmail/api/ --data 'api_key=ZzriUzE&slug=welcome&recipient=root@local.host&backend=mail'\n\n*API bandwidth is 1k+ rps on i7 2.3GHz*\n\n\nResponsive transactional HTML email templates\n---------------------------------------------\nFixtures with Base transactional HTML email templates was added into dbmail fixtures.\nThis templates was optimized for desktop clients, web clients, mobile clients, various devices, various providers.\nThanks for Mailgun Team. You can use it as default basic templates on your project.\n\n.. code-block:: bash\n\n    python manage.py load_dbmail_base_templates\n\n\n\nPublications\n------------\n* `\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c <http://habrahabr.ru/post/253445/>`_.\n* `Completely installation and usage with examples. Translated by Google <http://translate.google.com/translate?hl=en&sl=ru&tl=en&u=http://habrahabr.ru/post/253445/>`_.\n\n\nScreenshots\n-----------\n\n.. image:: /screenshots/template_edit.jpg\n.. image:: /screenshots/templates_changelist.jpg\n.. image:: /screenshots/template_log_changelist.jpg\n.. image:: /screenshots/template_log_view.jpg\n.. image:: /screenshots/group_change.jpg\n.. image:: /screenshots/signal_edit.jpg\n.. image:: /screenshots/signals_changelist.jpg\n.. image:: /screenshots/apps_view.jpg\n.. image:: /screenshots/apps_browse_vars.jpg\n.. image:: /screenshots/smtp_changelist.jpg\n.. image:: /screenshots/apikey_changelist.jpg\n.. image:: /screenshots/bcc_changelist.jpg\n.. image:: /screenshots/template_compare.jpg\n.. image:: /screenshots/tracking_edit.jpg\n.. image:: /screenshots/base_template_changelist.jpg\n.. image:: /screenshots/subscriptions_change.jpg\n.. image:: /screenshots/subscriptions_changelist.jpg\n\n\nCompatibility\n-------------\n* Python: 2.7, pypy2.7, 3.4, 3.5, 3.6, 3.7, pypy3.5\n* Django: 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Django module to easily send emails using django templates stored in a database.",
    "version": "2.4.2",
    "split_keywords": [
        "django",
        "db",
        "mail",
        "email",
        "html",
        "text",
        "tts",
        "sms",
        "push",
        "templates",
        "mailer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b24c3d70c6ee425423ae009885a95d6c89008d02c9b86acdac9dd413f36228f",
                "md5": "b0112cb9e8f657fd69a960865e598a3b",
                "sha256": "0c93aaf3b518b660c3e6dd6df6e38d07a0d0a6afb4854381d08598e1d6789012"
            },
            "downloads": -1,
            "filename": "riso_django_db_mailer-2.4.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b0112cb9e8f657fd69a960865e598a3b",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 92999,
            "upload_time": "2023-03-18T04:43:35",
            "upload_time_iso_8601": "2023-03-18T04:43:35.116508Z",
            "url": "https://files.pythonhosted.org/packages/2b/24/c3d70c6ee425423ae009885a95d6c89008d02c9b86acdac9dd413f36228f/riso_django_db_mailer-2.4.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "676df4f1fda60c10b04bdfd82223c374242e33e313c379f5b5b0041c01939030",
                "md5": "35f1e417530985a34dcebff84e5466c6",
                "sha256": "45e638862df137abc62245771e2b95fbccaf3188ef16a36514769698bca7b8b9"
            },
            "downloads": -1,
            "filename": "riso-django-db-mailer-2.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "35f1e417530985a34dcebff84e5466c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 70511,
            "upload_time": "2023-03-18T04:43:37",
            "upload_time_iso_8601": "2023-03-18T04:43:37.878924Z",
            "url": "https://files.pythonhosted.org/packages/67/6d/f4f1fda60c10b04bdfd82223c374242e33e313c379f5b5b0041c01939030/riso-django-db-mailer-2.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-18 04:43:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "LPgenerator",
    "github_project": "django-db-mailer",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "riso-django-db-mailer"
}
        
Elapsed time: 0.05146s