django-ses-backend


Namedjango-ses-backend JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/almazkun/django-ses-backend
SummaryDjango email backend for AWS SES (Amazon Simple Email Service) without boto3
upload_time2025-07-29 02:37:46
maintainerNone
docs_urlNone
authorAlmaz Kunpeissov
requires_python>=3.11
licenseMIT
keywords django email aws ses backend
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-ses-backend

Django AWS SES (Amazon Simple Email Service) email backend.

## Features
- Send emails via AWS SES without needing `boto3` or any other AWS SDK.
- No SMTP configuration required and faster email sending.
- Supports sending TXT and HTML emails.
- Lightweight and easy to integrate.
- Supports `EmailMessage` from Django's built-in mail framework.
- Custom SES client implementation for signing and sending requests.

## Requirements
- Python 3.11+
- Django 4.2+

## Installation

Install the package using pip:

```bash
pip install django-ses-backend
```

## AWS Setup

### Step 1: Create an AWS SES Account
1. Sign in to the [AWS Management Console](https://aws.amazon.com/console/).
2. Navigate to **Amazon SES** service.
3. Verify your email address or domain in the **Verified Identities** section.
4. Move your SES account out of **Sandbox Mode** (if needed) by requesting production access.

### Step 2: Create an IAM User for SES
1. Go to **IAM** in the AWS Console.
2. Create a new user and enable **Programmatic access**.
3. Attach the policy **AmazonSESFullAccess** (or create a custom policy with `ses:SendEmail` permissions).
4. Save the **Access Key ID** and **Secret Access Key**.

## Configuration

Update your Django settings:

```python
# settings.py
EMAIL_BACKEND = 'django_ses_backend.backends.SESEmailBackend'

SES_AWS_ACCESS_KEY_ID = 'YOUR_AWS_ACCESS_KEY_ID'
SES_AWS_SECRET_ACCESS_KEY = 'YOUR_AWS_SECRET_ACCESS_KEY'
SES_AWS_REGION = 'YOUR_AWS_REGION'
```

## Usage

You can send emails using Django's built-in `send_mail` or `EmailMessage`:

```python
from django.core.mail import send_mail

send_mail(
    subject="Hello from AWS SES",
    message="This is a test email.",
    from_email="your-email@example.com",
    recipient_list=["recipient@example.com"],
)
```

Or using `EmailMessage` for more customization:

```python
from django.core.mail import EmailMessage

email = EmailMessage(
    subject="Hello from AWS SES",
    body="This is a test email.",
    from_email="your-email@example.com",
    to=["recipient@example.com"],
)
email.send()
```

## Advanced Features

### Sending HTML Emails

```python
email = EmailMessage(
    subject="HTML Email Test",
    body="<h1>Hello from AWS SES</h1>",
    from_email="your-email@example.com",
    to=["recipient@example.com"],
)
email.content_subtype = "html"
email.send()
```

## Error Handling

If sending an email fails, a `SESClientError` is raised. You can handle errors gracefully:

```python
try:
    email.send()
except Exception as e:
    print(f"Failed to send email: {e}")
```

## Logging

Enable logging to track email sending:

```python
import logging

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("django_ses_backend")
```

## Notes
- Ensure your AWS SES account is verified and out of sandbox mode to send emails to unverified addresses.
- Configure AWS IAM policies to grant `ses:SendEmail` permissions to your credentials.

## Contributing
Feel free to submit issues or pull requests on GitHub to improve this package.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/almazkun/django-ses-backend",
    "name": "django-ses-backend",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "django, email, aws, ses, backend",
    "author": "Almaz Kunpeissov",
    "author_email": "hello@akun.dev",
    "download_url": "https://files.pythonhosted.org/packages/39/67/42be0ecdcc8e7953d9a4b2d8454ed65c09c185a484171d3fc260aa56a3be/django_ses_backend-0.1.1.tar.gz",
    "platform": null,
    "description": "# django-ses-backend\n\nDjango AWS SES (Amazon Simple Email Service) email backend.\n\n## Features\n- Send emails via AWS SES without needing `boto3` or any other AWS SDK.\n- No SMTP configuration required and faster email sending.\n- Supports sending TXT and HTML emails.\n- Lightweight and easy to integrate.\n- Supports `EmailMessage` from Django's built-in mail framework.\n- Custom SES client implementation for signing and sending requests.\n\n## Requirements\n- Python 3.11+\n- Django 4.2+\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install django-ses-backend\n```\n\n## AWS Setup\n\n### Step 1: Create an AWS SES Account\n1. Sign in to the [AWS Management Console](https://aws.amazon.com/console/).\n2. Navigate to **Amazon SES** service.\n3. Verify your email address or domain in the **Verified Identities** section.\n4. Move your SES account out of **Sandbox Mode** (if needed) by requesting production access.\n\n### Step 2: Create an IAM User for SES\n1. Go to **IAM** in the AWS Console.\n2. Create a new user and enable **Programmatic access**.\n3. Attach the policy **AmazonSESFullAccess** (or create a custom policy with `ses:SendEmail` permissions).\n4. Save the **Access Key ID** and **Secret Access Key**.\n\n## Configuration\n\nUpdate your Django settings:\n\n```python\n# settings.py\nEMAIL_BACKEND = 'django_ses_backend.backends.SESEmailBackend'\n\nSES_AWS_ACCESS_KEY_ID = 'YOUR_AWS_ACCESS_KEY_ID'\nSES_AWS_SECRET_ACCESS_KEY = 'YOUR_AWS_SECRET_ACCESS_KEY'\nSES_AWS_REGION = 'YOUR_AWS_REGION'\n```\n\n## Usage\n\nYou can send emails using Django's built-in `send_mail` or `EmailMessage`:\n\n```python\nfrom django.core.mail import send_mail\n\nsend_mail(\n    subject=\"Hello from AWS SES\",\n    message=\"This is a test email.\",\n    from_email=\"your-email@example.com\",\n    recipient_list=[\"recipient@example.com\"],\n)\n```\n\nOr using `EmailMessage` for more customization:\n\n```python\nfrom django.core.mail import EmailMessage\n\nemail = EmailMessage(\n    subject=\"Hello from AWS SES\",\n    body=\"This is a test email.\",\n    from_email=\"your-email@example.com\",\n    to=[\"recipient@example.com\"],\n)\nemail.send()\n```\n\n## Advanced Features\n\n### Sending HTML Emails\n\n```python\nemail = EmailMessage(\n    subject=\"HTML Email Test\",\n    body=\"<h1>Hello from AWS SES</h1>\",\n    from_email=\"your-email@example.com\",\n    to=[\"recipient@example.com\"],\n)\nemail.content_subtype = \"html\"\nemail.send()\n```\n\n## Error Handling\n\nIf sending an email fails, a `SESClientError` is raised. You can handle errors gracefully:\n\n```python\ntry:\n    email.send()\nexcept Exception as e:\n    print(f\"Failed to send email: {e}\")\n```\n\n## Logging\n\nEnable logging to track email sending:\n\n```python\nimport logging\n\nlogging.basicConfig(level=logging.DEBUG)\nlogger = logging.getLogger(\"django_ses_backend\")\n```\n\n## Notes\n- Ensure your AWS SES account is verified and out of sandbox mode to send emails to unverified addresses.\n- Configure AWS IAM policies to grant `ses:SendEmail` permissions to your credentials.\n\n## Contributing\nFeel free to submit issues or pull requests on GitHub to improve this package.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django email backend for AWS SES (Amazon Simple Email Service) without boto3",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/akun/django-ses-backend/issues",
        "Documentation": "https://github.com/almazkun/django-ses-backend#readme",
        "Homepage": "https://github.com/almazkun/django-ses-backend",
        "Repository": "https://github.com/almazkun/django-ses-backend"
    },
    "split_keywords": [
        "django",
        " email",
        " aws",
        " ses",
        " backend"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d5e6cb6cc865dc31994085540fc4edb08849982c1004a98ee92d4cf9be8319b",
                "md5": "5bfcad57985b56d27b4c496cb3265368",
                "sha256": "bfa57c9bfa572cc2ae54155895e31a186e7007005583539250a2da0236e24a5d"
            },
            "downloads": -1,
            "filename": "django_ses_backend-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5bfcad57985b56d27b4c496cb3265368",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 6136,
            "upload_time": "2025-07-29T02:37:44",
            "upload_time_iso_8601": "2025-07-29T02:37:44.776046Z",
            "url": "https://files.pythonhosted.org/packages/5d/5e/6cb6cc865dc31994085540fc4edb08849982c1004a98ee92d4cf9be8319b/django_ses_backend-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "396742be0ecdcc8e7953d9a4b2d8454ed65c09c185a484171d3fc260aa56a3be",
                "md5": "aaf56b1962a3ed51cdb3a6d235c75c30",
                "sha256": "7b78d88fb9843918702a71e21ab59a3f9aa0fab49ffbeaa319bcad7d30122aa8"
            },
            "downloads": -1,
            "filename": "django_ses_backend-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "aaf56b1962a3ed51cdb3a6d235c75c30",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 5356,
            "upload_time": "2025-07-29T02:37:46",
            "upload_time_iso_8601": "2025-07-29T02:37:46.009886Z",
            "url": "https://files.pythonhosted.org/packages/39/67/42be0ecdcc8e7953d9a4b2d8454ed65c09c185a484171d3fc260aa56a3be/django_ses_backend-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-29 02:37:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "almazkun",
    "github_project": "django-ses-backend",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "django-ses-backend"
}
        
Elapsed time: 1.55927s