Metadata-Version: 2.1
Name: django-mails
Version: 1.1.0
Summary: A Django Library to Send Simple/HTML Emails
Home-page: https://github.com/Hashtrust-technology-private-limited/django-email-service
Author: Hashtrust Technologies Private Limited
Author-email: support@hashtrust.in
License: MIT License
Classifier: Environment :: Web Environment
Classifier: Framework :: Django :: 4.1
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Communications :: Chat
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: django
Requires-Dist: django-ckeditor
Requires-Dist: django-js-asset
Requires-Dist: html2text
Requires-Dist: Jinja2
Requires-Dist: MarkupSafe
Requires-Dist: sqlparse

# django-mails

django-mails is Django App to send simple or HTML template Emails by calling just hit of single function.

Quick Start
-----------
1. Add 'email_service' to your INSTALLED_APPS setting like this::
    ```
    INSTALLED_APPS = [
        ...
        'email_service',
        'ckeditor',
    ]
    ```
2. Run ``python manage.py migrate`` to create the django-mails models.
3. 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
    ```
4. Add Templates path to your TEMPLATES in setting.py
5. import method to send email ``from email_service.utils import send_custom_email``
6. set ``LOGO_IMAGE_NAME`` variable in setting.py file to add logo in email (Name should include subfolder inside static folder)
7. 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` and `welcome_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
```
