Giter VIP home page Giter VIP logo

django-ogmios's Introduction

Django-Ogmios

Build Status

Just 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 <[email protected]>, {% for u in users %}{{ user.email }}, {% endfor %}
cc: John Doe <[email protected]>, {{ 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 <[email protected]>
  Organization: Example.org, Inc.
---
{% load special_filter %}

This is a list of special items:

{% for item in item_list %}
   * {{ item|special }}
{% endfor %}
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:

import functools
import ogmios

from myapp.models import User

send_registration = functools.partial(ogmios.send, 'mail/template.html')
send_registration({'user': User.objects.get(pk=1337)})

django-ogmios's People

Contributors

acatton avatar gavinwahl avatar julianandrews avatar jxcl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

sbellem

django-ogmios's Issues

Allow for non-markdown email sending

When sending fancy HTML emails, the markdown rendering could be problematic. It might be nice to be able to do something like the following.

- subject: Some subject
----
This is the plain text version

---- content-type: html
<p style="...">This is the HTML version</p>

Release on PyPI

if it is already on PyPI then please write that into the README.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.