Skip to main content

Enhanced email classes for Django

Project description

# django-enhanced-emails

## Getting started

- Install the package: `pipenv install django-enhanced-emails` (or, with you're still using pip: `pip install django-enhanced-emails`)
- Create a new email class:
```py
from enhanced_emails import EnhancedEmail


class WelcomeEmail(EnhancedEmail):
subject = 'Welcome to our site!'
html_template = 'emails/welcome.html'
```
Where `emails/welcome.html` could be:
```html
<strong>Welcome to our site {{first_name}}!</strong>

Best,
The OurSite team
```

- Instanciate a mail and send it:
```py
email = WelcomeEmail(
to=[user.email],
context={
'first_name': user.first_name
}
)
email.send()
```
- ✨ All done! Our user received something like:
```email
Content-Type: multipart/alternative;
boundary="===============7747654958126582044=="
MIME-Version: 1.0
Subject: hello
From: hello@oursite.com
To: user@gmail.com
Date: Wed, 11 Apr 2018 17:13:02 -0000
Message-ID: <152346678269.275.17989388690220812241@cf7f5f3375c9>

--===============7747654958126582044==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

Welcome to our site Elon!

Best,
The OurSite team
--===============7747654958126582044==
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

<strong>Welcome to our site Elon!</strong>

Best,
The OurSite team
--===============7747654958126582044==--
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-enhanced-emails-0.0.2.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file django-enhanced-emails-0.0.2.tar.gz.

File metadata

File hashes

Hashes for django-enhanced-emails-0.0.2.tar.gz
Algorithm Hash digest
SHA256 39f60bf5a94ab390806fa5b250753af8ab09e48bd73ca12cfb03c209da93dbc5
MD5 e5e494a247e848ba3e1ebc0192ccd71e
BLAKE2b-256 37a6b37c5e99ee195223a6d9b9b0f8add755f19e9be2ab5ae064f1b99613fe7d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page