Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
A emailing python library for emailing from alternative domains - DNS entries etc need to be assigned (not used for spamming).
Readme
smtpymailer
is a versatile Python library designed to simplify the process of sending emails in python. It supports
and validates DKIM, DMARC, and SPF records before sending emails to avoid being marked as spam, so it is ideal for sending
emails from your own mail server but the sender is an alternative domain.
To
, CC
, BCC
, Reply-To
, and attachments.data-inline
or data-base
in the img tag..env
files for mail server settings.Install the package using pip
:
pip install smtpymailer
Create an instance of SmtpyMailer
with your sender email and name. The mail server details can be passed as keyword
arguments or sourced from environment variables or a .env
file.
The following environment variables can be set or added to a .env
file in your project root.
Alternatively you can pass as **kwargs to the SmtpyMailer
class but this is not advised.
MAIL_SERVER
: The mail server hostname.MAIL_PORT
: The mail server port.MAIL_USE_TLS
: Whether to use TLS or not.MAIL_USERNAME
: The mail server username.MAIL_PASSWORD
: The mail server password.MAIL_DKIM_SELECTOR
: The DKIM selector of the domain you are sending from. (This is used to validate your ability to send from the domain).from smtpymailer import SmtpMailer
mailer = SmtpMailer(sender_email="foo@bar.com", sender_name="Foo Bar")
Use the send_email
method to send emails:
recipients
: Single recipient email or a list of email addresses.subject
: Email subject.cc_recipients
: (Optional) Single or list of CC email addresses.bcc_recipients
: (Optional) Single or list of BCC email addresses.reply_to
: (Optional) Reply-to email address.attachments
: (Optional) Single file path or list of file paths for attachments.html_content
: (Optional) HTML content of the email (not required if using a template)template
: (Optional) Template file path (using jinja), it can be just a plain html file.template_directory
: (Optional) Single or list of template directories.**kwargs
: Additional arguments for jinja template, if needed.from smtpymailer import SmtpMailer
mailer = SmtpMailer(sender_email="foo@bar.com", sender_name="Foo Bar")
mailer.send_email(recipients="bar@baz.com", subject="My test email", html_content="<h1>Hello World</h1>")
from smtpymailer import SmtpMailer
mailer = SmtpMailer(sender_email="foo@bar.com", sender_name="Foo Bar")
template_data = {"name": "Foo Bar", "message": "Hello Foo", "url": "https://www.foo.com"}
mailer.send_email(recipients=["bar@baz.com", "baz@bar.com"], cc_recipients="foo@baz.com", subject="My test email", template="template.html", template_directory="./templates", **template_data)
You can send emails from alternative domains by setting up the correct DNS settings. Here's how to do it. Alt Domains Documentation
This project is licensed under the MIT License.
alter_img_src
parameter works. It should AUTODETECT img elements with data-inline
or data-base
attributes instead.FAQs
A emailing python library for emailing from alternative domains - DNS entries etc need to be assigned (not used for spamming).
We found that smtpymailer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.