Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fusionbox/django-ogmios
No hassle, just sending emails
https://github.com/fusionbox/django-ogmios
Last synced: 3 months ago
JSON representation
No hassle, just sending emails
- Host: GitHub
- URL: https://github.com/fusionbox/django-ogmios
- Owner: fusionbox
- License: bsd-2-clause
- Created: 2015-06-18T23:37:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-07-02T19:24:14.000Z (over 4 years ago)
- Last Synced: 2024-07-28T10:01:21.598Z (3 months ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/django-ogmios
- Size: 43 KB
- Stars: 11
- Watchers: 9
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - django-ogmios - No hassle, just sending emails (Python)
README
=============
Django-Ogmios
=============
.. image:: https://travis-ci.org/fusionbox/django-ogmios.svg?branch=master
:target: https://travis-ci.org/fusionbox/django-ogmios
:alt: Build StatusJust sends emails. Simple, easy, multiformat.
For those wondering, `Ogmios `_ is just the Gallic god of eloquence.
Quickstart
==========Install from PyPI with ``pip``: ``pip install django-ogmios``.
``yourproject/templates/mail/template.html``::
from: [email protected]
to: Jane Doe , {% for u in users %}{{ user.email }}, {% endfor %}
cc: John Doe , {{ copy_user.get_full_name }} <{{ copy_user.email }}>
bcc: [email protected], [email protected]
subject: The whole email is a template
content-type: markdown
headers:
Reply-To: Jaqueline
Organization: Example.org, Inc.
---
{% load special_filter %}This is a list of special items:
{% for item in item_list %}
* {{ item|special }}
{% endfor %}.. code:: python
import ogmios
ogmios.send_email('mail/template.html',
{'item_list': ['Hello']},
attachments=[{
'path': '/path/to/file/',
'name': 'file.txt',
'type': 'text/plain',
}])This will render the content as markdown, and send the email with an HTML part and a Plaintext part.
For attachments, it is possible to just specify the path, or the path, filename and mimetype.Tips
====Resend an email with different context:
.. code:: python
import functools
import ogmiosfrom myapp.models import User
send_registration = functools.partial(ogmios.send, 'mail/template.html')
send_registration({'user': User.objects.get(pk=1337)})