Skip to main content

A Python package for sending emails using AWS SES

Project description

Sessender

Sessender is a Python package for sending emails using Amazon SES. It provides a simple interface for sending plain text and HTML emails, as well as attachments.

Installation

You can install Sessender using pip:

pip install sessender

Usage

To use Sessender, you need to provide your Amazon SES credentials as environment variables:

  • SES_USERNAME: Your Amazon SES SMTP username.
  • SES_PASS: Your Amazon SES SMTP password.
  • SES_HOST: Your Amazon SES SMTP host.
  • SES_PORT: Your Amazon SES SMTP port.
  • EMAIL_RECIPIENT: The recipient email address (optional, can be set when calling send_email).
  • EMAIL_SENDER: The sender email address (optional, can be set when calling send_email).

Then, create a SesSender object with your credentials:

from sessender import SesSender

sender = SesSender()


sender.send_email(
    subject='Hello, world!',
    message='This is a test email from Sessender.',
)

You can also include attachments with your emails by passing a file path to the attachment parameter:

sender.send_email(
    subject='Hello, world!',
    message='This is a test email from Sessender with an attachment.',
    attachment='/path/to/attachment.txt'
)

To send a html email, use the send_email method with the html_message parameter:

sender.send_email(
    subject='Hello, world!',
    html_message='<h1>This is a test email from Sessender in HTML format.</h1>',
)

You can also include attachments with your emails by passing a file path to the attachment parameter:

sender.send_email(
    subject='Hello, world!',
    html_message='This is a test email from Sessender with an attachment.',
    attachment='/path/to/attachment.txt'
)

send_email method parameters

This example demonstrates the usage of all the parameters available in the send_email method.

  • subject (required): A string representing the subject of the email.
  • message (optional): A string containing the plain text content of the email. Use either message or html_message, but not both.
  • html_message (optional): A string containing the HTML content of the email. Use either message or html_message, but not both.
  • attachment (optional): A file path to the attachment you want to include in the email. The attachment should be readable by the script.
  • sender (optional): A string representing the sender's email address. If not provided, the sender will be read from the EMAIL_SENDER environment variable.
  • recipients (optional): A list of strings representing the recipient email addresses. If not provided, the recipient will be read from the EMAIL_RECIPIENT environment variable.
  • cc (optional): A list of strings representing the CC (Carbon Copy) email addresses.
  • bcc (optional): A list of strings representing the BCC (Blind Carbon Copy) email addresses.

Example usage:

sender.send_email(
    subject='Hello, world!',
    message='This is a test email from Sessender.',
    recipients=['recipient1@example.com', 'recipient2@example.com'],
    sender='sender@example.com',
    cc=['cc1@example.com', 'cc2@example.com'],
    bcc=['bcc1@example.com', 'bcc2@example.com'],
    attachment='/path/to/attachment.txt'
)

Contributing

If you'd like to contribute to Sessender, please fork the repository and create a pull request. We welcome contributions of all kinds, including bug fixes, new features, and documentation improvements.

License

Sessender is licensed under the MIT License. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sessender-1.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sessender-1.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file sessender-1.1.0.tar.gz.

File metadata

  • Download URL: sessender-1.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for sessender-1.1.0.tar.gz
Algorithm Hash digest
SHA256 597d6f63af76554ee337707d877b19013cb27bec1b48dc7fced559eb2756142c
MD5 288ae1a8c124b559d1e5ba5f102e681a
BLAKE2b-256 918f2f2dfc3da25c603892d5ac30f61e92aa8eed833a9cddcc9407bf318cbfd8

See more details on using hashes here.

File details

Details for the file sessender-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: sessender-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for sessender-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c26f78847dbca18d339d07f683eb76dc5e74857cda48dd2ced6b74a055d9d3cb
MD5 ec05eba65fcf728bb9067e5e29316847
BLAKE2b-256 7a839fc0cb84e539cd15a7664e4e6f3a0c7658c405d0d09b7c4b04e99ed27308

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page