A Django Library to Send Simple/HTML Emails
Project description
django-mails
django-mails is Django App to send simple or HTML template Emails by calling just hit of single function.
Quick Start
- Add 'email_service' to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ... 'email_service', 'ckeditor', ]
- Run
python manage.py migrate
to create the django-mails models. - Set Email Settings in setting.py file
EMAIL_FROM = "" EMAIL_BCC = "" EMAIL_HOST = "" EMAIL_PORT = "" EMAIL_HOST_USER = "" EMAIL_HOST_PASSWORD = "" EMAIL_USE_TLS = True EMAIL_USE_SSL = False
- Add Templates path to your TEMPLATES in setting.py
- import method to send email
from email_service.utils import send_custom_email
- set
LOGO_IMAGE_NAME
variable in setting.py file to add logo in email (Name should include subfolder inside static folder) - To send html email : Create html and txt files for email content and subject respectively. Name of both file should be same and txt file name should contain "_subject" as suffix.
- for example :
welcome_email.html
andwelcome_email_subject.txt
Description
send_custom_email(
recipient: List[str] | str,
path: str | None = None,
template: any = None,
template_prefix: str | None = None,
context: Dict = {},
subject: str | None = None,
body: str | None = None,
attachment: any = None,
parts:list[dict] = None,
enable_logo : bool = False
)
- recipient : List of Receivers emails
- path : path to html file for email content and subject (path should be upto parent folder of html file inside template folder)
- template : Object of Template Model if exists (Optional)
- template_prefix : html file name
- context : context to replace variable name in template
- subject : subject of email as string
- body : content of email as string
- attachment: attach file to send email as attachement
- parts (list[dict]): list of dictionaries with part name and data
- enable_logo : set true to enable logo in email
Setup guideline
- build: Create the build and runtime images
docker-compose build
- up: Start up the project
docker-compose up
- To see services and their ports
docker ps
- shell: Shell into the running Django container
docker exec -it CONTAINER ID /bin/bash
- migrate: Changes you have made to your models
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django_mails-1.1.0.tar.gz
(9.8 kB
view details)
Built Distribution
File details
Details for the file django_mails-1.1.0.tar.gz
.
File metadata
- Download URL: django_mails-1.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 634a64734d708620e79605115a265ceff7fb779236019449c52f938419dfdddc |
|
MD5 | eb65f68ad94b386a7820f46a2490e1a9 |
|
BLAKE2b-256 | b541d6a442b86a1ba4b3838ee5170c30e8cd219726e4e056c05241554e6d9ec9 |
File details
Details for the file django_mails-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_mails-1.1.0-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0089459f2542916347065bdc007cc9fe6181ca4e07d2363d4e41ffc6bc58f548 |
|
MD5 | 7d56e6b0f74c39ea54cb2de729506474 |
|
BLAKE2b-256 | 956985512d85c927eaeba8d6c2e05b374c4b183bc34d6b80b9f7a8cd31b35a78 |