Skip to content

Streamline AWS SES with easy domain/email setup, bulk/single sending, unsubscribe handling, and stats webhooks.

Notifications You must be signed in to change notification settings

samueltrevor/easyses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasySES: Simplify Your AWS SES Management

EasySES is a Python tool designed to streamline AWS Simple Email Service (SES) operations like domain setup, email sending, and sender verification.

Table of Contents

  1. Features
  2. Prerequisites
  3. Installation
  4. Configuration
  5. Usage

Features

  • Set up new domains for SES.
  • Send emails, both single and bulk.
  • Verify single sender emails.
  • Delete domains or sender emails.

Prerequisites

  • AWS Account with SES and IAM permissions.

Installation

  1. Clone the repository: git clone https://github.com/samueltrevor/easyses
  2. Install required dependencies: pip install -r requirements.txt

Configuration

  1. Add the following variables to your .env file:

    • AWS_ACCESS_KEY_ID: Your AWS access key.
    • AWS_SECRET_ACCESS_KEY: Your AWS secret access key.
    • SES_REGION_NAME: Your AWS region.
    • UNSUBSCRIBE_URL_KEY: Your unsubscribe URL key. See instructions below.
    • CONFIGURATION_SET: Your AWS SES configuration set. This is optional.
  2. Generate a Fernet key for encryption:

    from cryptography.fernet import Fernet
    key = Fernet.generate_key()

    Add the key to your .env file as UNSUBSCRIBE_URL_KEY.

Usage

Set up a new domain

  • Add a new domain:

    dns_records = setup_new_domain(domain)

    Add the DNS records to your domain provider.

  • Check domain setup status:

    verify_dns_records(domain)

Send emails

  • Bulk send:

    send_emails(
      subject,
      html_content,
      from_name,
      from_email,
      email_id,
      recipients, # A list of emails
      reply_to, # optional
      org_name, # your clients organisation name, it would be used in the unsubscribe footer
      bg_color  # optional, it sets the background color of the unsubscribe footer
    )
  • Single send:

    There isn't a function for single send, Use your server's built-in SMTP client.

    Example:

    send_mail(
        subject,
        body,
        from_email,
        [to_email],
        html_message=body,
        fail_silently=False,
    )

    Or use boto3 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ses/client/send_email.html

Delete a domain

delete_domain(domain)

Verify a sender email

Note: sending emails without verifying the domain is not recommended.

verify_sender_email(email)

This sends a verification email. For customization, upload an HTML template named verification_email to SES.

Check single email status

verify_sender_email(email)

Delete a single sender

delete_sender_email(email)

Unsubscribe footer

Creates an encrypted unsubscribe link.

  • To decrypt the link:
    decrypt_link(encrypted_token)

About

Streamline AWS SES with easy domain/email setup, bulk/single sending, unsubscribe handling, and stats webhooks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published