{ "info": { "author": "Michael OConnor", "author_email": "michael@mcoconnor.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "Django Email Templates\n======================\n\n\u00a9 2019 Michael O\u2019Connor, http://www.mcoconnor.net\nhttps://github.com/mcoconnor/django-emailmessagetemplates\n\nIn many cases, users will want to be able to edit the emails sent by\nyour application without having to go to developers to change hard-coded\nemail content. This package provides a Django app that allows users to\nedit email content with an easy-to-integrate developer API.\n\nRequirements\n------------\n\nDjango Email Templates supports versions 1.9-1.11 of Django under Python 2.7.\n\n| |Build Status| |Coverage Status|\n\n- `django-appconf`_ is the only external dependency.\n- `html2text`_ is required to use the text autogeneration\n functionality.\n\nInstallation\n------------\n\nDjango Email Templates is a standard Django app. \n\nTo add it to a project, just include ``'emailmessagetemplates'`` in the \n``INSTALLED_APPS`` section of your ``settings.py`` file.\n\nIf you would like to use text version autogeneration for HTML templates, \ninclude the `text_autogen` extras in your install (e.g. \n``pip install django-emailmessagetemplates[text_autogen]``) or ensure \nyou've installed ``html2text`` separately.\n\nUsage\n-----\n\nThe central piece of functionality in this app is the\nEmailMessageTemplate class, which is a Django model that also inherits\nfrom Django\u2019s ``EmailMultiAlternatives`` class. Usage is derived from\nits parents: to select a template to send, query for it as a model. To\nsend an email, first populate the message with the template context,\nrecipients, and other data, and then call the ``send`` method. For\nexample:\n\n::\n from emailmessagetemplates.models import EmailMessageTemplate\n \n t = EmailMessageTemplate.objects.get(name='Hello World')\n t.context = {'a':'hello','b':'world'}\n t.to = ['michael@mcoconnor.net',]\n t.attach_file('/docs/Hello.pdf')\n t.send()\n\nEmail templates support the same attributes that\n``EmailMultiAlternatives``\\ s do, including ``to``, ``cc``, ``bcc``,\n``from_email``, ``headers``, and ``attachments``.\n\nHTML/Multipart Messages\n-----------------------\n\nDjango Email Templates can either send plain text emails or HTML\nformatted messages with plain-text alternative content. To enable HTML\nemails, the ``EMAILMESSAGETEMPLATES_ALLOW_HTML_MESSAGES`` setting must\nbe set to ``True``, and the ``type`` field on the\n``EmailMessageTemplate`` instance must be set to \u2018HTML\u2019. Plain text\nalternative can either be auto-generated from the rendered HTML body\ncontent (via the HTML2Text library, which converts the message to\nMarkdown) or by manually maintaining a separate plain text body\ntemplate.\n\nConvenience Functions\n---------------------\n\nThe email convenience functions provided by Django replicated for\nmessage templates. These include ``send_mail``, ``send_mass_mail``,\n``mail_admins``, ``mail_managers`` and are used similarly:\n\n::\n from emailmessagetemplates.utils import send_mail, send_mass_mail, \\\n mail_admins, mail_managers\n \n send_mail(name, related_object=None, context={}, from_email=None,\n recipient_list=[], fail_silently=False, auth_user=None,\n auth_password=None, connection=None)\n\n send_mass_mail(name, related_object=None, datatuple=(), fail_silently=False,\n auth_user=None, auth_password=None, connection=None) \n\n mail_admins(name, related_object=None, context={}, fail_silently=False,\n connection=None)\n \n mail_managers(name, related_object=None, context={}, fail_silently=False,\n connection=None)\n\nDifferences from ``EmailMultiAlternatives``\n-------------------------------------------\n\nWhile ``EmailMessageTemplate`` behaves like Django\u2019s\n``EmailMultiAlternatives`` in many ways, there are some differences:\n\n- Subject and body values cannot be set directly; instead they\u2019re\n constructed from templates saved in the model rendered against the\n specified context\n- If ``from_email`` is not specified when a message is prepared, the\n value defaults first to the ``sender`` set on the template model,\n then to the ``EMAILMESSAGETEMPLATES_DEFAULT_FROM_EMAIL`` setting\n- Values required by the message (e.g the recipients) cannot be set in\n the ``EmailMessageTemplate`` constructor like they are for\n ``EmailMessage`` (since normally you will retrieve an existing model\n instance rather than constructing one). Instead, they must be set\n individually on the instance.\n- An HTML alternative is automatically added for messages with an HTML\n type (when HTML messages are permitted by application settings). A\n plain text alternative is also provided, either generated from a\n separate template or autogenerated from the HTML content.\n\nSettings\n--------\n\n**EMAILMESSAGETEMPLATES_DEFAULT_FROM_EMAIL**\n\nDefault: The ``DEFAULT_FROM_EMAIL`` value from your project\u2019s settings.\n\nThe default email address to use for message sent from templates. This\nis can be overridden on a per-template basis by setting the ``sender``\nfield on the template model instance. It can be overridden on a\nper-email basis by setting the ``from_email`` attribute on an\ninstantiated ``EmailMessageTemaple`` object or using the ``from_email``\nargument to any of the convenience functions.\n\n**EMAILMESSAGETEMPLATES_ALLOW_HTML_MESSAGES**\n\nDefault: False\n\nIf true, templates can produce HTML-formatted messages and provide\nplain-text alternative content. Enabling this option will display\nadditional fields in the Django admin form and will enable HTML\ngeneration for templates that have a ``type`` of ``text/html``. \n\n.. _django-appconf: https://pypi.python.org/pypi/django-appconf/0.6\n.. _html2text: https://pypi.python.org/pypi/html2text\n\n.. |Build Status| image:: https://travis-ci.org/mcoconnor/django-emailmessagetemplates.svg?branch=master\n :target: https://travis-ci.org/mcoconnor/django-emailmessagetemplates\n.. |Coverage Status| image:: https://coveralls.io/repos/mcoconnor/django-emailmessagetemplates/badge.svg?branch=master\n :target: https://coveralls.io/r/mcoconnor/django-emailmessagetemplates?branch=master\n\n\n\nHistory\n-------\n\n0.1.3 (2019-5-11)\n++++++++++++++++++\n\n* Update for Django 1.11\n\n0.1.2 (2016-5-6)\n++++++++++++++++++\n\n* Update for Django>=1.9\n\n0.1.1 (2015-3-19)\n++++++++++++++++++\n\n* Fix packaging errors\n* Add South initial migration\n\n0.1.0 (2015-3-18)\n++++++++++++++++++\n\n* First release on PyPI.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mcoconnor/django-emailmessagetemplates", "keywords": "django,email,template", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-emailmessagetemplates", "package_url": "https://pypi.org/project/django-emailmessagetemplates/", "platform": "", "project_url": "https://pypi.org/project/django-emailmessagetemplates/", "project_urls": { "Homepage": "https://github.com/mcoconnor/django-emailmessagetemplates" }, "release_url": "https://pypi.org/project/django-emailmessagetemplates/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "A Django app that allows users to edit email content with an easy-to-integrate developer API.", "version": "0.1.3" }, "last_serial": 5256978, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "eb9efa93555d74b9ef80d71c13c255a5", "sha256": "8c336d31485d02fc86be67a45224fe5b41cc13187ab1e8567644c9dcb608318a" }, "downloads": -1, "filename": "django-emailmessagetemplates-0.1.0.tar.gz", "has_sig": false, "md5_digest": "eb9efa93555d74b9ef80d71c13c255a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16426, "upload_time": "2015-03-18T20:17:14", "url": "https://files.pythonhosted.org/packages/c6/aa/1403325cb1ce58165e2bc0ccbb268f72b0e00617eeb0952d8da66cbaa3ad/django-emailmessagetemplates-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a67dbf1d4457b6ac77901c4b8b47a50a", "sha256": "68fc02cb69f4864d4fed75f8ee1a518226172075d58b2d4ad93770fe1c3900f8" }, "downloads": -1, "filename": "django-emailmessagetemplates-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a67dbf1d4457b6ac77901c4b8b47a50a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38018, "upload_time": "2015-03-19T02:14:36", "url": "https://files.pythonhosted.org/packages/f3/91/8f7434fc63247ffcd7e273551613dd0e4660550ed68ba53ce6c8cde709a0/django-emailmessagetemplates-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b85b65ed99e28b53e2d0078bff3cf520", "sha256": "b18b16f357828109076c996fdabf1d183711577d12a04b9fdd91387dda2724de" }, "downloads": -1, "filename": "django-emailmessagetemplates-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b85b65ed99e28b53e2d0078bff3cf520", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17611, "upload_time": "2016-04-06T19:19:47", "url": "https://files.pythonhosted.org/packages/5c/83/48aeea8edfb702a17a1b8647b3137c9e2d9c46bcc7b7c24e5c594524439a/django-emailmessagetemplates-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "daa29c3c3c1431a91f7565befa3f0cb0", "sha256": "6cf1f9ded477af18f27cfee15483494a51439a57562922e7ba5fa0ad8f9fc53a" }, "downloads": -1, "filename": "django-emailmessagetemplates-0.1.3.tar.gz", "has_sig": false, "md5_digest": "daa29c3c3c1431a91f7565befa3f0cb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16114, "upload_time": "2019-05-11T19:07:01", "url": "https://files.pythonhosted.org/packages/87/76/99f82ca1957f60a4b32905a0e8f5c4ef415652c8fbf8c3955418951b8e6d/django-emailmessagetemplates-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "daa29c3c3c1431a91f7565befa3f0cb0", "sha256": "6cf1f9ded477af18f27cfee15483494a51439a57562922e7ba5fa0ad8f9fc53a" }, "downloads": -1, "filename": "django-emailmessagetemplates-0.1.3.tar.gz", "has_sig": false, "md5_digest": "daa29c3c3c1431a91f7565befa3f0cb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16114, "upload_time": "2019-05-11T19:07:01", "url": "https://files.pythonhosted.org/packages/87/76/99f82ca1957f60a4b32905a0e8f5c4ef415652c8fbf8c3955418951b8e6d/django-emailmessagetemplates-0.1.3.tar.gz" } ] }