{ "info": { "author": "Jerome Paradis", "author_email": "jparadis@paradivision.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "=====\r\nUsage\r\n=====\r\n\r\ndjango-mailing was developed to:\r\n * send emails in ASCII or HTML\r\n * support email templating with headers and footers\r\n * support multilingual environments\r\n * optionally use SendGrid to categorize email statistics and sync email lists\r\n * optionally support celery for queuing mail sending and/or processing in background processes\r\n\r\nInstallation\r\n============\r\n\r\nAvailable on PyPi::\r\n\r\n pip install django-mailing\r\n\r\nConfiguration\r\n=============\r\n\r\nAdd to your installed apps in your setting.py file::\r\n\r\n INSTALLED_APPS = (\r\n ...\r\n 'mailing',\r\n )\r\n\r\nsettings.DEFAULT_FROM_EMAIL\r\n---------------------------\r\n\r\nYou need to set your default from email::\r\n\r\n DEFAULT_FROM_EMAIL = 'contact@mydomain.com'\r\n\r\n\r\nsettings.MAILING_USE_SENDGRID\r\n-----------------------------\r\n\r\nBoolean to indicate you have configured Django to use SendGrid::\r\n\r\n MAILING_USE_SENDGRID = True\r\n\r\nThe impact is you now have additional SendGrid capabilities such as the ability to:\r\n * categorize emails sent\r\n * manage/sync mailing lists (currently not implemented)\r\n * plus all the good stuff they do on their side.\r\n\r\nsettings.MAILING_MAILTO_HIJACK\r\n------------------------------\r\n\r\nYou can hijack email sent by your app to redirect to another email. Quite practical when developing or testing with external email addresses::\r\n\r\n MAILING_MAILTO_HIJACK = 'me@mydomain.com'\r\n\r\nIf defined, every outgoind email will be sent to me@mydomain.com. For debugging/testing purposes, the following header is added to the email::\r\n\r\n X-MAILER-ORIGINAL-MAILTO: me@mydomain.com\r\n\r\nIt will contain what would have been the original \"To\" header if we hadn't hijacked it\r\n\r\nsettings.MAILING_USE_CELERY\r\n---------------------------\r\n\r\nBoolean indicating celery is configured and you want to send/process email related stuff in background::\r\n\r\n MAILING_USE_CELERY = True\r\n\r\nFor example, you can configure your app to use celery by installing a redis server.\r\n\r\nYour settings would also need to include things like::\r\n\r\n INSTALLED_APPS = (\r\n #\r\n # ...\r\n #\r\n\r\n 'celery',\r\n 'djcelery',\r\n\r\n #\r\n # ...\r\n #\r\n\r\n 'mailing',\r\n\r\n #\r\n # ...\r\n #\r\n )\r\n \r\n # \r\n # ...\r\n #\r\n \r\n # Celery Configuration. Ref.: http://celery.github.com/celery/configuration.htm\r\n # -------------------------------------\r\n os.environ[\"CELERY_LOADER\"] = \"django\"\r\n djcelery.setup_loader()\r\n\r\n BROKER_TRANSPORT = \"redis\"\r\n BROKER_HOST = \"localhost\" # Maps to redis host.\r\n BROKER_PORT = 6379 # Maps to redis port.\r\n BROKER_VHOST = \"0\" # Maps to database number.\r\n\r\n CELERY_IGNORE_RESULT = False\r\n CELERY_RESULT_BACKEND = \"redis\"\r\n CELERY_REDIS_HOST = \"localhost\"\r\n CELERY_REDIS_PORT = 6379\r\n CELERY_REDIS_DB = 0\r\n\r\nWhen running the celery daemon, you need to include the ``mailing`` app in the tasks through the ``include`` parameter. Example::\r\n\r\n manage.py celeryd --verbosity=2 --beat --schedule=celery --events --loglevel=INFO -I mailing\r\n\r\nYou therefore could run a separate celery daemon to run your mailing tasks independently of other tasks if the need arises.\r\n\r\nsettings.MAILING_LANGUAGES\r\n--------------------------\r\n\r\nNot yet implemented.\r\n\r\nReplacing the core django send_mail function\r\n--------------------------------------------\r\n\r\nTo replace Django's core send_mail function to add support for email templates, SendGrid integration and background celery sending, add the following code to your settings file::\r\n\r\n import sys\r\n from mailing.mail import send_email_default\r\n try:\r\n from django.core import mail \r\n mail.send_mail = send_email_default\r\n sys.modules['django.core.mail'] = mail\r\n except ImportError:\r\n pass\r\n\r\n\r\nUsing django-mailing\r\n====================\r\n\r\nSimple multi-part send_mail replacement\r\n---------------------------------------\r\n\r\nYou can using mailing.send_email instead of Django's send_mail to send multi-part messages::\r\n\r\n send_email(recipients, subject, text_content=None, html_content=None, from_email=settings.DEFAULT_FROM_EMAIL, category=None, fail_silently=False, bypass_queue=False)\r\n\r\nParameters are:\r\n * ``recipients`` is a list of email addresses to send the email to\r\n * ``subject`` is the subject of your email\r\n * ``text_content`` is the ASCII content of the email\r\n * ``html_content`` is the HTML content of the email\r\n * ``from_email`` is a string and is the sender's address\r\n * ``category`` is a string and is used to define SendGrid's X-SMTPAPI's category header\r\n\r\nYou must supply at least text_content or html_content. If both aren't supplied, an exception will be raised. If only one of the two is supplied, the email will be sent in the corresponding format. If both content are supplied, a multi-part email will be sent.\r\n\r\nExample usage::\r\n\r\n from mailing import send_email\r\n\r\n send_email(['test1@mydomain.com', 'test@mydomain.com'], 'Testing 1,2,3...', 'Text Body', 'HTML Body', category='testing')\r\n\r\nRendering and sending emails using templates\r\n--------------------------------------------\r\n\r\nTo use Django templates to generate dynamic emails, similar to using ``render_with_context`` in a Django view, use the ``render_send_email`` shortcut::\r\n\r\n render_send_email(recipients, template, data, from_email=settings.DEFAULT_FROM_EMAIL, subject=None, category=None, fail_silently=False, language='en', bypass_queue=False)\r\n\r\nParameters are:\r\n * ``recipients`` is a list of email addresses to send the email to\r\n * ``template`` the path to your Django templates, without any extension\r\n * ``data`` data context dictionnary to render the template\r\n * ``from_email`` is a string and is the sender's address\r\n * ``subject`` is the subject of your email\r\n * ``category`` is a string and is used to define SendGrid's X-SMTPAPI's category header\r\n\r\nExample::\r\n\r\n def send_welcome_email(user):\r\n from mailing.shortcuts import render_send_email\r\n \r\n render_send_email(['test1@mydomain.com', 'test@mydomain.com'], 'users/welcome', {'user': user}, category='welcome')\r\n\r\nin your app, you would need the following template files with the right extensions:\r\n * ``templates/users/welcome.txt``\r\n * ``templates/users/welcome.html``\r\n * ``templates/users/welcome.subject``\r\n\r\nThe subject template file can be omitted but you then need to supply the ``subject`` parameter. If you do not create a template with a .txt or a .html extension, then the associated format won't be included in the email. So, if you want to only send ASCII messages, do not create a .html file.\r\n\r\nExample without using a subject template::\r\n\r\n render_send_email(['test1@mydomain.com', 'test@mydomain.com'], 'app/welcome', data, subject='Welcome new user', category='welcome')\r\n\r\nTemplates\r\n---------\r\n\r\nThe following templates are defined and used by django-mailing and should be overriten in your own templates:\r\n * ``templates/mailing/base.txt``\r\n * ``templates/mailing/base.html``\r\n\r\nThese are used to define your email overall look like the header and footer. The only requirement is to include the ``{{ content }}`` template variable. It is there than the supplied content of your email will be inserted in your base template.\r\n\r\nLICENSE\r\n=======\r\n\r\nCopyright (c) 2009 Jerome Paradis, Alain Carpentier and contributors\r\n\r\nPermission is hereby granted, free of charge, to any person\r\nobtaining a copy of this software and associated documentation\r\nfiles (the \"Software\"), to deal in the Software without\r\nrestriction, including without limitation the rights to use,\r\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the\r\nSoftware is furnished to do so, subject to the following\r\nconditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\r\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\r\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\r\nOTHER DEALINGS IN THE SOFTWARE.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/JeromeParadis/django-mailing", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "django-mailing", "package_url": "https://pypi.org/project/django-mailing/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-mailing/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/JeromeParadis/django-mailing" }, "release_url": "https://pypi.org/project/django-mailing/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "A flexible Django app for templated mailings with support for celery queuing, SendGrid and more.", "version": "0.1.3" }, "last_serial": 2328013, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "1f159ec5fc4c293d0803950e0450c687", "sha256": "e5e006e73980f6b0fae09f10a3c44bb10fee8d58b4b5775c227a54aa4e4b147e" }, "downloads": -1, "filename": "django-mailing-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1f159ec5fc4c293d0803950e0450c687", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13105, "upload_time": "2013-09-05T16:21:48", "url": "https://files.pythonhosted.org/packages/b6/26/4ff3c25d12d2e9cf2bc9fceece8f67d9630a3ae2a598af7aff075a1361c2/django-mailing-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "a2a13eb7b7db63134e6f251cb65a2e38", "sha256": "871ac118b68ce7428d207aa2c3149c78d8f298b7c8a087b290484b010665d8d7" }, "downloads": -1, "filename": "django-mailing-0.1.3.tar.gz", "has_sig": false, "md5_digest": "a2a13eb7b7db63134e6f251cb65a2e38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13186, "upload_time": "2016-09-06T19:37:46", "url": "https://files.pythonhosted.org/packages/6b/e5/440fe6ed938f0e19d108eccf402ba027320f7e671fca943b292b7b5517db/django-mailing-0.1.3.tar.gz" } ], "0.1beta10": [ { "comment_text": "", "digests": { "md5": "b6785aa56d18f5b486394a647f700fcd", "sha256": "c7542fed5b5245b08d11fcd1cb192e02b2b749fbfb68e490446b6326880253a1" }, "downloads": -1, "filename": "django-mailing-0.1beta10.tar.gz", "has_sig": false, "md5_digest": "b6785aa56d18f5b486394a647f700fcd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12944, "upload_time": "2013-08-06T16:01:58", "url": "https://files.pythonhosted.org/packages/c3/66/9ad0252aaa5a9455cf443090d2a5ae446714c85cd20c040305eabb82c666/django-mailing-0.1beta10.tar.gz" } ], "0.1beta5": [ { "comment_text": "", "digests": { "md5": "9ef4ecd88fd6173a45fb4727943343c6", "sha256": "3f0721a4475544e0e1847a44fd120f14b262a94b85db950eeb1c8a3c4cd9d51d" }, "downloads": -1, "filename": "django-mailing-0.1beta5.tar.gz", "has_sig": false, "md5_digest": "9ef4ecd88fd6173a45fb4727943343c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7094, "upload_time": "2012-09-20T19:13:36", "url": "https://files.pythonhosted.org/packages/6e/da/d4e67215572188dd4fce5ffb157467d4d3313c67551115f87d9cda58cb3f/django-mailing-0.1beta5.tar.gz" } ], "0.1beta6": [ { "comment_text": "", "digests": { "md5": "78a5c8d0d603d441608f130fa21e45fa", "sha256": "09b1c7fd738e6e64d22153451656fc7b1143629ff55031fdba65567258f47e50" }, "downloads": -1, "filename": "django-mailing-0.1beta6.tar.gz", "has_sig": false, "md5_digest": "78a5c8d0d603d441608f130fa21e45fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13842, "upload_time": "2012-09-21T18:07:29", "url": "https://files.pythonhosted.org/packages/11/9f/c37688b6ecd801cd5a1497409b5aac8029ec87f3c7177141fdf431a27090/django-mailing-0.1beta6.tar.gz" } ], "0.1beta7": [ { "comment_text": "", "digests": { "md5": "14964502216a0c92d91129783eabc25a", "sha256": "f8b940edb53c11bc694d6074326938a64312b0c94657b05c5ec73ddc98931128" }, "downloads": -1, "filename": "django-mailing-0.1beta7.tar.gz", "has_sig": false, "md5_digest": "14964502216a0c92d91129783eabc25a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13859, "upload_time": "2012-11-05T18:28:16", "url": "https://files.pythonhosted.org/packages/5c/ab/0796ea2d8d92ca3d51efcfbc85034c377403aed1745288681ae13e8a69b1/django-mailing-0.1beta7.tar.gz" } ], "0.1beta8": [ { "comment_text": "", "digests": { "md5": "e76b45ce8c42a8fc7d3818c25daec096", "sha256": "a7b143a11a06297988f0d5b4f4691dd945dd2d514a4e4cffcc05a6c543577ea6" }, "downloads": -1, "filename": "django-mailing-0.1beta8.tar.gz", "has_sig": false, "md5_digest": "e76b45ce8c42a8fc7d3818c25daec096", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12806, "upload_time": "2013-01-11T17:52:30", "url": "https://files.pythonhosted.org/packages/d4/74/fa5708177c50805b3e206d38bd30ff79ca806217c41bf7f66d21930e876b/django-mailing-0.1beta8.tar.gz" } ], "0.1beta9": [ { "comment_text": "", "digests": { "md5": "75153c2a4ed430ccadc78701cb84bfa1", "sha256": "df99cf2b255b1f5d1c6c70972428b98348f8608f97ffd9cdba54833bdb8e97ab" }, "downloads": -1, "filename": "django-mailing-0.1beta9.tar.gz", "has_sig": false, "md5_digest": "75153c2a4ed430ccadc78701cb84bfa1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12907, "upload_time": "2013-01-17T15:51:34", "url": "https://files.pythonhosted.org/packages/6c/fa/dd5f2d5a2fa0bcf525186a87ea6809a228f69a40d2308e0ea3a8e0309ac6/django-mailing-0.1beta9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a2a13eb7b7db63134e6f251cb65a2e38", "sha256": "871ac118b68ce7428d207aa2c3149c78d8f298b7c8a087b290484b010665d8d7" }, "downloads": -1, "filename": "django-mailing-0.1.3.tar.gz", "has_sig": false, "md5_digest": "a2a13eb7b7db63134e6f251cb65a2e38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13186, "upload_time": "2016-09-06T19:37:46", "url": "https://files.pythonhosted.org/packages/6b/e5/440fe6ed938f0e19d108eccf402ba027320f7e671fca943b292b7b5517db/django-mailing-0.1.3.tar.gz" } ] }