Management commands

Create template

(venv)$ python emailhub --create-template


Performs a diff between a JSON fixture file and template present in database.

(venv)$ python emailhub --diff emailtemplates-backup.json

By default only changed field are shown, to get a full word level diff you can set verbosity at 2.

(venv)$ python emailhub --diff emailtemplates-backup.json -v2


Dumps specific email templates specified by slug in JSON format.

Multiple slug can be passed using comas as separators.

(venv)$ python emailhub --dump request-accepted,request-received

Dump all

Dumps all email template in JSON format.

List templates

List available templates and their corresponding translations.

(venv)$ python emailhub --list-templates

  - EN) [{{ site }}] We have accepted your request!
  - FR) [{{ site }}] Nous aons accepté votre demande!

  - EN) [{{ site }}] New request from {{ user.get_fullname }}
  - FR) [{{ site }}] Nouvelle demande de {{ user.get_fullname }}


Send unsent emails:

(venv)$ python emailhub --send

Since email batch sending is throttled, you can set up a cron job to run every minutes to send unsent emails. This way an email will never wait more than one minute before being sent in a optimal situation.

*  * * * * root /venv/path/bin/python /project/path/ emailhub --send >> /var/log/emailhub.log 2>&1

Send test

Sends an email test, accepts a destination email address or a user ID.

(venv)$ python emailhub --send-test
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: Test email
Date: Tue, 06 Mar 2018 19:01:16 -0000
Message-ID: <20180306190116.2915.53062@singularity>

This is a test.


(venv)$ python emailhub --status

    Unsent                        14
    Drafts                        7
    Is sent                       7
    Errors                        0