Skip to content

jneight/django-mail-factory-extras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-mail-factory-extras

Extra features for django-mail-factory.

New features:

  • SMS factory to handle SMS like mails, Twilio integration implemented.
  • Async email class to send email via celery.

SMS Factory:

  • Defining SMS templates:
    • Define your templates inside a folder templates/sms/<template_name>/body.html.
  • Registering a SMS message using Twilio backend (Twilio python client needed):

    from mailfactory_extras import smsfactory
    from mailfactory_extras.sms.twilio.sms import TwilioSMS
    
    
    class InvitationSMS(TwilioSMS):
        template_name = "invitation"
        params = ['user']
    
    
    smsfactory.register(InvitationSMS)
    • template_name defines the name of the template to use.
    • params is the dict with the context variables the template will receive.
  • Sending SMS, just call send() from the smsfactory:

    from mailfactory_extras import smsfactory
    
    smsfactory.send('invitation', {'user': 'Foo'})

Async email class:

Define your email class using CeleryMail.

from mail_factory import factory
from mailfactory_extras.backends.celery import CeleryMail


class InvitationAsyncEmail(CeleryMail):
    template_name = "invitation"
    params = ['user']


factory.register(InvitationAsyncEmail)

About

Extra funtionality for django-mail-factory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages