Coder Social home page Coder Social logo

django-simple-mail's Introduction

django-simple-mail v0.1.0 on PyPi MIT license Stable

django-simple-mail

Simple customizable email template built for Django

Requirements

These Django app works with :

  • Python (>=2.7) (Need to be tested for 3.x)
  • Django (>=1.9) (Need to be tested for previous versions)

Installation

Install using pip :

pip install django_simple_mail

Add simple_mail to your INSTALLED_APPS setting.

INSTALLED_APPS = (
    ...
    'simple_mail',
)

Then run :

python manage.py makemigrations python manage.py migrate

Preview and customization:

The default mail template is a fork of Mailchimp email-blueprints and looks like this with placeholder values:

Email Preview

You can customize the template with CONTEXT settings :

DEFAULTS = {
    'CONTEXT': {
        'header_url': 'http://placehold.it/600x150',
        'footer_links': [],
        'footer_copyright': '',
        'footer_content': "Here is your content",
        'colors': {
            'background': "#EEEEEE",
            'container_border': "#DDDDDD",
            'container_background': "#FFFFFF",
            'container': "#505050",
            'title': "#444444",
            'footer': "#888888",
            'footer_link': "#2C9AB7",
            'button': "#2C9AB7",
        }
    }
}

Django Admin

You can manage your emails and their content directly from django admin :

Admin Preview

You can also use variables inside the fields to make your content more dynamic :

Admin Preview

Settings

Here are all the settings you can define:

SIMPLE_MAIL = {
    'CONTEXT': {
        'header_url': 'http://placehold.it/600x150',
        'footer_links': [],
        'footer_copyright': '',
        'footer_content': "Here is your content",
        'colors': {
            'background': "#EEEEEE",
            'container_border': "#DDDDDD",
            'container_background': "#FFFFFF",
            'container': "#505050",
            'title': "#444444",
            'footer': "#888888",
            'footer_link': "#2C9AB7",
            'button': "#2C9AB7",
        }
    },
    'TEMPLATE': 'simple_mail/default.html',
    'EMAILS': [],
    'BASE_URL': '',
    'FROM_EMAIL': ''
}

CONTEXT

Defines the values that needs to be populated to all your emails.

TEMPLATE

Defines the path to the template that is used by default. You can use this setting in case your want to modify the default template.

EMAILS

Defines the list of different emails that are used inside your project, for example :

DEFAULTS = {
    'EMAILS': [
    	['RESETPWD', 'Reset password'],
    	['WELCOME', 'Welcome a user'],
    	['VALIDATE', 'Validate a user email'],
    ]
}

BASE_URL

Defines the base url to resolve links.

FROM_EMAIL

Defines the mail to send from by default.

Support

If you are having issues, please let us know or submit a pull request.

License

The project is licensed under the MIT License.

django-simple-mail's People

Contributors

charlesthk avatar

Watchers

James Cloos avatar  avatar

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.