From dd46906375e8d3c0cdc046e91c6287f589a42ff8 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 10 Apr 2023 22:51:45 +0000 Subject: automatic import of python-django-sendgrid-v5 --- .gitignore | 1 + python-django-sendgrid-v5.spec | 522 +++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 524 insertions(+) create mode 100644 python-django-sendgrid-v5.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..c2d0662 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/django-sendgrid-v5-1.2.2.tar.gz diff --git a/python-django-sendgrid-v5.spec b/python-django-sendgrid-v5.spec new file mode 100644 index 0000000..12bc05d --- /dev/null +++ b/python-django-sendgrid-v5.spec @@ -0,0 +1,522 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-sendgrid-v5 +Version: 1.2.2 +Release: 1 +Summary: An implementation of Django's EmailBackend compatible with sendgrid-python v5+ +License: MIT +URL: https://github.com/sklarsa/django-sendgrid-v5 +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/4a/51/a371b8816e55b289139311b85b9c51e81dd344b99c46761820b582e837a6/django-sendgrid-v5-1.2.2.tar.gz +BuildArch: noarch + +Requires: python3-django +Requires: python3-sendgrid +Requires: python3-http-client + +%description +# django-sendgrid-v5 + +[![Latest Release](https://img.shields.io/pypi/v/django-sendgrid-v5.svg)](https://pypi.python.org/pypi/django-sendgrid-v5/) + +This package implements an email backend for Django that relies on sendgrid's REST API for message delivery. + +It is under active development, and pull requests are more than welcome\! + +To use the backend, simply install the package (using pip), set the `EMAIL_BACKEND` setting in Django, and add a `SENDGRID_API_KEY` key (set to the appropriate value) to your Django settings. + +## How to Install + +1. `pip install django-sendgrid-v5` +2. In your project's settings.py script: + 1. Set `EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"` + 2. Set the SENDGRID\_API\_KEY in settings.py to your api key that was provided to you by sendgrid. `SENDGRID_API_KEY = os.environ["SENDGRID_API_KEY"]` + +### Other settings + +1. To toggle sandbox mode (when django is running in DEBUG mode), set `SENDGRID_SANDBOX_MODE_IN_DEBUG = True/False`. + 1. To err on the side of caution, this defaults to True, so emails sent in DEBUG mode will not be delivered, unless this setting is explicitly set to False. +2. `SENDGRID_ECHO_TO_STDOUT` will echo to stdout or any other file-like + object that is passed to the backend via the `stream` kwarg. +3. `SENDGRID_TRACK_EMAIL_OPENS` - defaults to true and tracks email open events via the Sendgrid service. These events are logged in the Statistics UI, Email Activity interface, and are reported by the Event Webhook. +4. `SENDGRID_TRACK_CLICKS_HTML` - defaults to true and, if enabled in your Sendgrid account, will tracks click events on links found in the HTML message sent. +5. `SENDGRID_TRACK_CLICKS_PLAIN` - defaults to true and, if enabled in your Sendgrid account, will tracks click events on links found in the plain text message sent. + +## Usage + +### Simple + +```python +from django.core.mail import send_mail + +send_mail( + 'Subject here', + 'Here is the message.', + 'from@example.com', + ['to@example.com'], + fail_silently=False, +) +``` + +### Dynamic Template with JSON Data + +First, create a [dynamic template](https://mc.sendgrid.com/dynamic-templates) and copy the ID. + +```python +from django.core.mail import EmailMessage + +msg = EmailMessage( + from_email='to@example.com', + to=['to@example.com'], +) +msg.template_id = "your-dynamic-template-id" +msg.dynamic_template_data = { + "title": foo +} +msg.send(fail_silently=False) +``` + +### The kitchen sink EmailMessage (all of the supported sendgrid-specific properties) + +```python +from django.core.mail import EmailMessage + +msg = EmailMessage( + from_email='to@example.com', + to=['to@example.com'], + cc=['cc@example.com'], + bcc=['bcc@example.com'], +) + +# Personalization custom args +# https://sendgrid.com/docs/for-developers/sending-email/personalizations/ +msg.custom_args = {'arg1': 'value1', 'arg2': 'value2'} + +# Reply to email address (sendgrid only supports 1 reply-to email address) +msg.reply_to = 'reply-to@example.com' + +# Send at (accepts an integer per the sendgrid docs) +# https://docs.sendgrid.com/for-developers/sending-email/scheduling-parameters#send-at +msg.send_at = 1600188812 + +# Transactional templates +# https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/ +msg.template_id = "your-dynamic-template-id" +msg.dynamic_template_data = { # Sendgrid v6+ only + "title": foo +} +msg.substitutions = { + "title": bar +} + +# Unsubscribe groups +# https://sendgrid.com/docs/ui/sending-email/unsubscribe-groups/ +msg.asm = {'group_id': 123, 'groups_to_display': ['group1', 'group2']} + +# Categories +# https://sendgrid.com/docs/glossary/categories/ +msg.categories = ['category1', 'category2'] + +# IP Pools +# https://sendgrid.com/docs/ui/account-and-settings/ip-pools/ +msg.ip_pool_name = 'my-ip-pool' + + +msg.send(fail_silently=False) +``` + + +### FAQ +**How to change a Sender's Name ?** + + +`from_email="John Smith "` +You can just include the name in the from_email field of the _```EmailMessage```_ class + +``` +msg = EmailMessage( + from_email='Sender Name ', + to=['to@example.com'], +) +``` + +**How to make mails to multiple users private (hide all the email addresses to which the mail is sent) to each person (personalization) ?** + + +Setting the `make_private` attribute to `True` will help us achieve it +``` +msg = EmailMessage( + from_email='Sender Name ', + to=['to@example.com','abc@example.com','xyz@example.com'], +) +msg.make_private = True +``` + +## Examples + +- Marcelo Canina [(@marcanuy)](https://github.com/marcanuy) wrote a great article demonstrating how to integrate `django-sendgrid-v5` into your Django application on his site: [https://simpleit.rocks/python/django/adding-email-to-django-the-easiest-way/](https://simpleit.rocks/python/django/adding-email-to-django-the-easiest-way/) +- RX-36 [(@DevWoody856)](https://github.com/DevWoody856) demonstrates how to use `django-sendgrid-v5` to make a contact form for your web application: https://rx-36.life/post/create-a-contact-form-using-sendgrid-in-django/ + + +## Stargazers over time + +[![Stargazers over time](https://starchart.cc/sklarsa/django-sendgrid-v5.svg)](https://starchart.cc/sklarsa/django-sendgrid-v5) + + + + + +%package -n python3-django-sendgrid-v5 +Summary: An implementation of Django's EmailBackend compatible with sendgrid-python v5+ +Provides: python-django-sendgrid-v5 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-sendgrid-v5 +# django-sendgrid-v5 + +[![Latest Release](https://img.shields.io/pypi/v/django-sendgrid-v5.svg)](https://pypi.python.org/pypi/django-sendgrid-v5/) + +This package implements an email backend for Django that relies on sendgrid's REST API for message delivery. + +It is under active development, and pull requests are more than welcome\! + +To use the backend, simply install the package (using pip), set the `EMAIL_BACKEND` setting in Django, and add a `SENDGRID_API_KEY` key (set to the appropriate value) to your Django settings. + +## How to Install + +1. `pip install django-sendgrid-v5` +2. In your project's settings.py script: + 1. Set `EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"` + 2. Set the SENDGRID\_API\_KEY in settings.py to your api key that was provided to you by sendgrid. `SENDGRID_API_KEY = os.environ["SENDGRID_API_KEY"]` + +### Other settings + +1. To toggle sandbox mode (when django is running in DEBUG mode), set `SENDGRID_SANDBOX_MODE_IN_DEBUG = True/False`. + 1. To err on the side of caution, this defaults to True, so emails sent in DEBUG mode will not be delivered, unless this setting is explicitly set to False. +2. `SENDGRID_ECHO_TO_STDOUT` will echo to stdout or any other file-like + object that is passed to the backend via the `stream` kwarg. +3. `SENDGRID_TRACK_EMAIL_OPENS` - defaults to true and tracks email open events via the Sendgrid service. These events are logged in the Statistics UI, Email Activity interface, and are reported by the Event Webhook. +4. `SENDGRID_TRACK_CLICKS_HTML` - defaults to true and, if enabled in your Sendgrid account, will tracks click events on links found in the HTML message sent. +5. `SENDGRID_TRACK_CLICKS_PLAIN` - defaults to true and, if enabled in your Sendgrid account, will tracks click events on links found in the plain text message sent. + +## Usage + +### Simple + +```python +from django.core.mail import send_mail + +send_mail( + 'Subject here', + 'Here is the message.', + 'from@example.com', + ['to@example.com'], + fail_silently=False, +) +``` + +### Dynamic Template with JSON Data + +First, create a [dynamic template](https://mc.sendgrid.com/dynamic-templates) and copy the ID. + +```python +from django.core.mail import EmailMessage + +msg = EmailMessage( + from_email='to@example.com', + to=['to@example.com'], +) +msg.template_id = "your-dynamic-template-id" +msg.dynamic_template_data = { + "title": foo +} +msg.send(fail_silently=False) +``` + +### The kitchen sink EmailMessage (all of the supported sendgrid-specific properties) + +```python +from django.core.mail import EmailMessage + +msg = EmailMessage( + from_email='to@example.com', + to=['to@example.com'], + cc=['cc@example.com'], + bcc=['bcc@example.com'], +) + +# Personalization custom args +# https://sendgrid.com/docs/for-developers/sending-email/personalizations/ +msg.custom_args = {'arg1': 'value1', 'arg2': 'value2'} + +# Reply to email address (sendgrid only supports 1 reply-to email address) +msg.reply_to = 'reply-to@example.com' + +# Send at (accepts an integer per the sendgrid docs) +# https://docs.sendgrid.com/for-developers/sending-email/scheduling-parameters#send-at +msg.send_at = 1600188812 + +# Transactional templates +# https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/ +msg.template_id = "your-dynamic-template-id" +msg.dynamic_template_data = { # Sendgrid v6+ only + "title": foo +} +msg.substitutions = { + "title": bar +} + +# Unsubscribe groups +# https://sendgrid.com/docs/ui/sending-email/unsubscribe-groups/ +msg.asm = {'group_id': 123, 'groups_to_display': ['group1', 'group2']} + +# Categories +# https://sendgrid.com/docs/glossary/categories/ +msg.categories = ['category1', 'category2'] + +# IP Pools +# https://sendgrid.com/docs/ui/account-and-settings/ip-pools/ +msg.ip_pool_name = 'my-ip-pool' + + +msg.send(fail_silently=False) +``` + + +### FAQ +**How to change a Sender's Name ?** + + +`from_email="John Smith "` +You can just include the name in the from_email field of the _```EmailMessage```_ class + +``` +msg = EmailMessage( + from_email='Sender Name ', + to=['to@example.com'], +) +``` + +**How to make mails to multiple users private (hide all the email addresses to which the mail is sent) to each person (personalization) ?** + + +Setting the `make_private` attribute to `True` will help us achieve it +``` +msg = EmailMessage( + from_email='Sender Name ', + to=['to@example.com','abc@example.com','xyz@example.com'], +) +msg.make_private = True +``` + +## Examples + +- Marcelo Canina [(@marcanuy)](https://github.com/marcanuy) wrote a great article demonstrating how to integrate `django-sendgrid-v5` into your Django application on his site: [https://simpleit.rocks/python/django/adding-email-to-django-the-easiest-way/](https://simpleit.rocks/python/django/adding-email-to-django-the-easiest-way/) +- RX-36 [(@DevWoody856)](https://github.com/DevWoody856) demonstrates how to use `django-sendgrid-v5` to make a contact form for your web application: https://rx-36.life/post/create-a-contact-form-using-sendgrid-in-django/ + + +## Stargazers over time + +[![Stargazers over time](https://starchart.cc/sklarsa/django-sendgrid-v5.svg)](https://starchart.cc/sklarsa/django-sendgrid-v5) + + + + + +%package help +Summary: Development documents and examples for django-sendgrid-v5 +Provides: python3-django-sendgrid-v5-doc +%description help +# django-sendgrid-v5 + +[![Latest Release](https://img.shields.io/pypi/v/django-sendgrid-v5.svg)](https://pypi.python.org/pypi/django-sendgrid-v5/) + +This package implements an email backend for Django that relies on sendgrid's REST API for message delivery. + +It is under active development, and pull requests are more than welcome\! + +To use the backend, simply install the package (using pip), set the `EMAIL_BACKEND` setting in Django, and add a `SENDGRID_API_KEY` key (set to the appropriate value) to your Django settings. + +## How to Install + +1. `pip install django-sendgrid-v5` +2. In your project's settings.py script: + 1. Set `EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"` + 2. Set the SENDGRID\_API\_KEY in settings.py to your api key that was provided to you by sendgrid. `SENDGRID_API_KEY = os.environ["SENDGRID_API_KEY"]` + +### Other settings + +1. To toggle sandbox mode (when django is running in DEBUG mode), set `SENDGRID_SANDBOX_MODE_IN_DEBUG = True/False`. + 1. To err on the side of caution, this defaults to True, so emails sent in DEBUG mode will not be delivered, unless this setting is explicitly set to False. +2. `SENDGRID_ECHO_TO_STDOUT` will echo to stdout or any other file-like + object that is passed to the backend via the `stream` kwarg. +3. `SENDGRID_TRACK_EMAIL_OPENS` - defaults to true and tracks email open events via the Sendgrid service. These events are logged in the Statistics UI, Email Activity interface, and are reported by the Event Webhook. +4. `SENDGRID_TRACK_CLICKS_HTML` - defaults to true and, if enabled in your Sendgrid account, will tracks click events on links found in the HTML message sent. +5. `SENDGRID_TRACK_CLICKS_PLAIN` - defaults to true and, if enabled in your Sendgrid account, will tracks click events on links found in the plain text message sent. + +## Usage + +### Simple + +```python +from django.core.mail import send_mail + +send_mail( + 'Subject here', + 'Here is the message.', + 'from@example.com', + ['to@example.com'], + fail_silently=False, +) +``` + +### Dynamic Template with JSON Data + +First, create a [dynamic template](https://mc.sendgrid.com/dynamic-templates) and copy the ID. + +```python +from django.core.mail import EmailMessage + +msg = EmailMessage( + from_email='to@example.com', + to=['to@example.com'], +) +msg.template_id = "your-dynamic-template-id" +msg.dynamic_template_data = { + "title": foo +} +msg.send(fail_silently=False) +``` + +### The kitchen sink EmailMessage (all of the supported sendgrid-specific properties) + +```python +from django.core.mail import EmailMessage + +msg = EmailMessage( + from_email='to@example.com', + to=['to@example.com'], + cc=['cc@example.com'], + bcc=['bcc@example.com'], +) + +# Personalization custom args +# https://sendgrid.com/docs/for-developers/sending-email/personalizations/ +msg.custom_args = {'arg1': 'value1', 'arg2': 'value2'} + +# Reply to email address (sendgrid only supports 1 reply-to email address) +msg.reply_to = 'reply-to@example.com' + +# Send at (accepts an integer per the sendgrid docs) +# https://docs.sendgrid.com/for-developers/sending-email/scheduling-parameters#send-at +msg.send_at = 1600188812 + +# Transactional templates +# https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/ +msg.template_id = "your-dynamic-template-id" +msg.dynamic_template_data = { # Sendgrid v6+ only + "title": foo +} +msg.substitutions = { + "title": bar +} + +# Unsubscribe groups +# https://sendgrid.com/docs/ui/sending-email/unsubscribe-groups/ +msg.asm = {'group_id': 123, 'groups_to_display': ['group1', 'group2']} + +# Categories +# https://sendgrid.com/docs/glossary/categories/ +msg.categories = ['category1', 'category2'] + +# IP Pools +# https://sendgrid.com/docs/ui/account-and-settings/ip-pools/ +msg.ip_pool_name = 'my-ip-pool' + + +msg.send(fail_silently=False) +``` + + +### FAQ +**How to change a Sender's Name ?** + + +`from_email="John Smith "` +You can just include the name in the from_email field of the _```EmailMessage```_ class + +``` +msg = EmailMessage( + from_email='Sender Name ', + to=['to@example.com'], +) +``` + +**How to make mails to multiple users private (hide all the email addresses to which the mail is sent) to each person (personalization) ?** + + +Setting the `make_private` attribute to `True` will help us achieve it +``` +msg = EmailMessage( + from_email='Sender Name ', + to=['to@example.com','abc@example.com','xyz@example.com'], +) +msg.make_private = True +``` + +## Examples + +- Marcelo Canina [(@marcanuy)](https://github.com/marcanuy) wrote a great article demonstrating how to integrate `django-sendgrid-v5` into your Django application on his site: [https://simpleit.rocks/python/django/adding-email-to-django-the-easiest-way/](https://simpleit.rocks/python/django/adding-email-to-django-the-easiest-way/) +- RX-36 [(@DevWoody856)](https://github.com/DevWoody856) demonstrates how to use `django-sendgrid-v5` to make a contact form for your web application: https://rx-36.life/post/create-a-contact-form-using-sendgrid-in-django/ + + +## Stargazers over time + +[![Stargazers over time](https://starchart.cc/sklarsa/django-sendgrid-v5.svg)](https://starchart.cc/sklarsa/django-sendgrid-v5) + + + + + +%prep +%autosetup -n django-sendgrid-v5-1.2.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-django-sendgrid-v5 -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot - 1.2.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..702d469 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +7ede16d681cc0ce57c635f8617f0c31c django-sendgrid-v5-1.2.2.tar.gz -- cgit v1.2.3