# 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Hashtrust-technology-private-limited/django-email-service",
"name": "django-mails",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Hashtrust Technologies Private Limited",
"author_email": "support@hashtrust.in",
"download_url": "https://files.pythonhosted.org/packages/b5/41/d6a442b86a1ba4b3838ee5170c30e8cd219726e4e056c05241554e6d9ec9/django_mails-1.1.0.tar.gz",
"platform": null,
"description": "# django-mails\n\ndjango-mails is Django App to send simple or HTML template Emails by calling just hit of single function.\n\nQuick Start\n-----------\n1. Add 'email_service' to your INSTALLED_APPS setting like this::\n ```\n INSTALLED_APPS = [\n ...\n 'email_service',\n 'ckeditor',\n ]\n ```\n2. Run ``python manage.py migrate`` to create the django-mails models.\n3. Set Email Settings in setting.py file\n ```\n EMAIL_FROM = \"\"\n EMAIL_BCC = \"\"\n EMAIL_HOST = \"\"\n EMAIL_PORT = \"\"\n EMAIL_HOST_USER = \"\"\n EMAIL_HOST_PASSWORD = \"\"\n EMAIL_USE_TLS = True\n EMAIL_USE_SSL = False\n ```\n4. Add Templates path to your TEMPLATES in setting.py\n5. import method to send email ``from email_service.utils import send_custom_email``\n6. set ``LOGO_IMAGE_NAME`` variable in setting.py file to add logo in email (Name should include subfolder inside static folder)\n7. 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.\n- for example : `welcome_email.html` and `welcome_email_subject.txt`\n\nDescription\n-----------\n```\nsend_custom_email(\n recipient: List[str] | str,\n path: str | None = None,\n template: any = None,\n template_prefix: str | None = None,\n context: Dict = {},\n subject: str | None = None,\n body: str | None = None,\n attachment: any = None,\n parts:list[dict] = None,\n enable_logo : bool = False\n)\n```\n* recipient : List of Receivers emails\n* path : path to html file for email content and subject (path should be upto parent folder of html file inside template folder)\n* template : Object of Template Model if exists (Optional)\n* template_prefix : html file name\n* context : context to replace variable name in template\n* subject : subject of email as string\n* body : content of email as string\n* attachment: attach file to send email as attachement\n* parts (list[dict]): list of dictionaries with part name and data\n* enable_logo : set true to enable logo in email\n\n\n# Setup guideline\n\n- build: Create the build and runtime images\n```\n docker-compose build\n```\n\n- up: Start up the project\n```\n docker-compose up\n```\n- To see services and their ports\n```\n docker ps\n```\n- shell: Shell into the running Django container\n```\n docker exec -it CONTAINER ID /bin/bash\n```\n- migrate: Changes you have made to your models\n```\n python manage.py makemigrations\n python manage.py migrate\n python manage.py createsuperuser\n```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A Django Library to Send Simple/HTML Emails",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/Hashtrust-technology-private-limited/django-email-service"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "956985512d85c927eaeba8d6c2e05b374c4b183bc34d6b80b9f7a8cd31b35a78",
"md5": "7d56e6b0f74c39ea54cb2de729506474",
"sha256": "0089459f2542916347065bdc007cc9fe6181ca4e07d2363d4e41ffc6bc58f548"
},
"downloads": -1,
"filename": "django_mails-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d56e6b0f74c39ea54cb2de729506474",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12621,
"upload_time": "2024-06-05T12:38:50",
"upload_time_iso_8601": "2024-06-05T12:38:50.670578Z",
"url": "https://files.pythonhosted.org/packages/95/69/85512d85c927eaeba8d6c2e05b374c4b183bc34d6b80b9f7a8cd31b35a78/django_mails-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b541d6a442b86a1ba4b3838ee5170c30e8cd219726e4e056c05241554e6d9ec9",
"md5": "eb65f68ad94b386a7820f46a2490e1a9",
"sha256": "634a64734d708620e79605115a265ceff7fb779236019449c52f938419dfdddc"
},
"downloads": -1,
"filename": "django_mails-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "eb65f68ad94b386a7820f46a2490e1a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9754,
"upload_time": "2024-06-05T12:38:51",
"upload_time_iso_8601": "2024-06-05T12:38:51.783262Z",
"url": "https://files.pythonhosted.org/packages/b5/41/d6a442b86a1ba4b3838ee5170c30e8cd219726e4e056c05241554e6d9ec9/django_mails-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-05 12:38:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Hashtrust-technology-private-limited",
"github_project": "django-email-service",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "django-mails"
}