Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
.. image:: https://github.com/feinheit/django-email-hosts/actions/workflows/tests.yml/badge.svg :target: https://github.com/feinheit/django-email-hosts/ :alt: CI Status
Some projects may want to sent emails over multiple SMTP relays or smarthosts.
Examples are sites running on multiple domains, e.g. info@example.com
and
info@example.org
. It may be possible to use the same SMTP credentials for
each sender address but if that isn't possible django-email-hosts may be a good
solution for the problem.
pip install django-email-hosts
EMAIL_HOSTS
settingemail_hosts.backends.get_connection
EMAIL_HOSTS
The keys of the EMAIL_HOSTS
dictionary are defined by you and there's no
deeper meaning to them. The values are DSNs inspired by dj-email-url <https://github.com/migonzalvar/dj-email-url>
__ DSNs.
An example configuration (which is possibly nonsensical) looks like this:
.. code-block:: python
EMAIL_HOSTS = {
"sendgrid": "submission://USER:PASSWORD@smtp.sendgrid.com?_default_from_email=info@example.com",
"mailgun": "submission://USER:PASSWORD@smtp.mailgun.com?_default_from_email=info@example.org",
}
This configuration creates two SMTP backends, one using sendgrid and one using
mailgun. The _default_from_email
is completely optional. If the email
message's from_email
isn't set (resp. is equal to the
DEFAULT_FROM_EMAIL
setting) it automatically defaults to the per-backend
value.
email_hosts.backends.get_connection
The get_connection
function expects a single key for the EMAIL_HOSTS
setting above. Sending a single email using an explicit connection may look as
follows, using the settings from above:
.. code-block:: python
from django.core.mail import EmailMessage
from email_hosts.backends import get_connection
EmailMessage(
"Hello",
"World",
to=["recipient@example.com"],
connection=get_connection("sendgrid"),
).send()
get_connection
currently silently returns the default email backend if the
key doesn't exist in the EMAIL_HOSTS
dictionary.
FAQs
Support for several SMTP configurations in a single site
We found that django-email-hosts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.