mailbridge


Namemailbridge JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryFlexible mail delivery library supporting multiple providers (SMTP, SendGrid, Mailgun, SES, Postmark, Brevo)
upload_time2025-10-25 09:45:21
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords email smtp mailgun sendgrid aws ses postmark brevo
VCS
bugtrack_url
requirements setuptools wheel python-dotenv
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 📧 MailBridge

**MailBridge** is a flexible Python library for sending emails, allowing you to use multiple providers through a single, simple interface.
It supports **SMTP**, **SendGrid**, **Mailgun**, **Amazon SES**, **Postmark**, and **Brevo**.

The package uses the **Facade pattern**, so clients only need to call one method to send an email, while the provider implementation can be swapped via configuration.

## ⚡ Features
- Unified API for all email providers (`Mail.send(...)`)
- Support for: SMTP, SendGrid, Mailgun, Amazon SES, Postmark, Brevo
- Configurable via `.env` file
- Easy integration into any Python project
- Selective provider installation

## 🛠️ Tech Stack

- Python 3.10+
- `requests` for HTTP providers
- `boto3` for AWS SES
- Standard library `smtplib` for SMTP

## 📦 Installation

Install only the providers you need using **extras**:
```
# Only SMTP
pip install mailbridge[smtp]

# Only SES
pip install mailbridge[ses]

# Only SendGrid
pip install mailbridge[sendgrid]

# All providers
pip install mailbridge[all]
```

## ⚙️ Configuration

Create a `.env` file and define the variables for your chosen provider:

```
# Example for SMTP
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailserver.com
MAIL_PORT=587
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_TLS_ENCRYPTION=True
MAIL_SSL_ENCRYPTION=False

# Example for SendGrid
MAIL_MAILER=sendgrid
MAIL_API_KEY=your_sendgrid_api_key
MAIL_ENDPOINT=https://api.sendgrid.com/v3/mail/send
```

## 🚀 Usage
### Sending an email:

```
from mailbridge.mail import Mail

Mail.send(
    to="user@example.com",
    subject="Welcome!",
    body="<h1>Hello from MailBridge!</h1>",
    from_email="no-reply@example.com"
)
```

### Dynamically choosing a provider from `.env`:
- Change `MAIL_MAILER` in `.env` to `"smtp"`, `"sendgrid"`, `"mailgun"`, `"ses"`, `"postmark"` or `"brevo"`.
- MailBridge will automatically use the corresponding provider

## 📂 Project Structure

```
mailbridge/
├── mailbridge/
│   ├── __init__.py
│   ├── mail.py               # Facade
│   ├── mailer_factory.py     # MailerFactory
│   └── providers/
│       ├── provider_interface.py
│       ├── smtp_provider.py
│       ├── sendgrid_provider.py
│       ├── mailgun_provider.py
│       ├── ses_provider.py
│       ├── postmark_provider.py
│       └── brevo_provider.py
├── tests/
├── setup.py
├── pyproject.toml
└── README.md
```

## 📝 License

This project is licensed under the [MIT License](https://opensource.org/license/MIT).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mailbridge",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "email, smtp, mailgun, sendgrid, aws, ses, postmark, brevo",
    "author": null,
    "author_email": "Radomir Brkovi\u0107 <brkovic.radomir@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/12/a9/e29d75ec89603404dcc06ae299af59b1d294562f6aa65be0f4dcd1291f7e/mailbridge-1.0.1.tar.gz",
    "platform": null,
    "description": "# \ud83d\udce7 MailBridge\n\n**MailBridge** is a flexible Python library for sending emails, allowing you to use multiple providers through a single, simple interface.\nIt supports **SMTP**, **SendGrid**, **Mailgun**, **Amazon SES**, **Postmark**, and **Brevo**.\n\nThe package uses the **Facade pattern**, so clients only need to call one method to send an email, while the provider implementation can be swapped via configuration.\n\n## \u26a1 Features\n- Unified API for all email providers (`Mail.send(...)`)\n- Support for: SMTP, SendGrid, Mailgun, Amazon SES, Postmark, Brevo\n- Configurable via `.env` file\n- Easy integration into any Python project\n- Selective provider installation\n\n## \ud83d\udee0\ufe0f Tech Stack\n\n- Python 3.10+\n- `requests` for HTTP providers\n- `boto3` for AWS SES\n- Standard library `smtplib` for SMTP\n\n## \ud83d\udce6 Installation\n\nInstall only the providers you need using **extras**:\n```\n# Only SMTP\npip install mailbridge[smtp]\n\n# Only SES\npip install mailbridge[ses]\n\n# Only SendGrid\npip install mailbridge[sendgrid]\n\n# All providers\npip install mailbridge[all]\n```\n\n## \u2699\ufe0f Configuration\n\nCreate a `.env` file and define the variables for your chosen provider:\n\n```\n# Example for SMTP\nMAIL_MAILER=smtp\nMAIL_HOST=smtp.mailserver.com\nMAIL_PORT=587\nMAIL_USERNAME=your_username\nMAIL_PASSWORD=your_password\nMAIL_TLS_ENCRYPTION=True\nMAIL_SSL_ENCRYPTION=False\n\n# Example for SendGrid\nMAIL_MAILER=sendgrid\nMAIL_API_KEY=your_sendgrid_api_key\nMAIL_ENDPOINT=https://api.sendgrid.com/v3/mail/send\n```\n\n## \ud83d\ude80 Usage\n### Sending an email:\n\n```\nfrom mailbridge.mail import Mail\n\nMail.send(\n    to=\"user@example.com\",\n    subject=\"Welcome!\",\n    body=\"<h1>Hello from MailBridge!</h1>\",\n    from_email=\"no-reply@example.com\"\n)\n```\n\n### Dynamically choosing a provider from `.env`:\n- Change `MAIL_MAILER` in `.env` to `\"smtp\"`, `\"sendgrid\"`, `\"mailgun\"`, `\"ses\"`, `\"postmark\"` or `\"brevo\"`.\n- MailBridge will automatically use the corresponding provider\n\n## \ud83d\udcc2 Project Structure\n\n```\nmailbridge/\n\u251c\u2500\u2500 mailbridge/\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 mail.py               # Facade\n\u2502   \u251c\u2500\u2500 mailer_factory.py     # MailerFactory\n\u2502   \u2514\u2500\u2500 providers/\n\u2502       \u251c\u2500\u2500 provider_interface.py\n\u2502       \u251c\u2500\u2500 smtp_provider.py\n\u2502       \u251c\u2500\u2500 sendgrid_provider.py\n\u2502       \u251c\u2500\u2500 mailgun_provider.py\n\u2502       \u251c\u2500\u2500 ses_provider.py\n\u2502       \u251c\u2500\u2500 postmark_provider.py\n\u2502       \u2514\u2500\u2500 brevo_provider.py\n\u251c\u2500\u2500 tests/\n\u251c\u2500\u2500 setup.py\n\u251c\u2500\u2500 pyproject.toml\n\u2514\u2500\u2500 README.md\n```\n\n## \ud83d\udcdd License\n\nThis project is licensed under the [MIT License](https://opensource.org/license/MIT).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Flexible mail delivery library supporting multiple providers (SMTP, SendGrid, Mailgun, SES, Postmark, Brevo)",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/radomirbrkovic/mailbridge/issues",
        "Homepage": "https://github.com/radomirbrkovic/mailbridge"
    },
    "split_keywords": [
        "email",
        " smtp",
        " mailgun",
        " sendgrid",
        " aws",
        " ses",
        " postmark",
        " brevo"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "34359c4f1d632f2064c7cf5bc5098badc4dc1c98471d12c0fab71b915c12e5e7",
                "md5": "2b3001844328483f0053af182d16d443",
                "sha256": "91772a5fc5fddc5070a19a0ddce29795013b439f27da4f76e2e05cb3175fa770"
            },
            "downloads": -1,
            "filename": "mailbridge-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b3001844328483f0053af182d16d443",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8876,
            "upload_time": "2025-10-25T09:45:19",
            "upload_time_iso_8601": "2025-10-25T09:45:19.680456Z",
            "url": "https://files.pythonhosted.org/packages/34/35/9c4f1d632f2064c7cf5bc5098badc4dc1c98471d12c0fab71b915c12e5e7/mailbridge-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "12a9e29d75ec89603404dcc06ae299af59b1d294562f6aa65be0f4dcd1291f7e",
                "md5": "c3b4ad5c7bc8f0387c0dc3614c7e15e5",
                "sha256": "2fd90a321865fe888023c33a9830b59bd6686060e842eeab713b3b42c9448136"
            },
            "downloads": -1,
            "filename": "mailbridge-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c3b4ad5c7bc8f0387c0dc3614c7e15e5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 9830,
            "upload_time": "2025-10-25T09:45:21",
            "upload_time_iso_8601": "2025-10-25T09:45:21.117891Z",
            "url": "https://files.pythonhosted.org/packages/12/a9/e29d75ec89603404dcc06ae299af59b1d294562f6aa65be0f4dcd1291f7e/mailbridge-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-25 09:45:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "radomirbrkovic",
    "github_project": "mailbridge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "setuptools",
            "specs": [
                [
                    "==",
                    "80.9.0"
                ]
            ]
        },
        {
            "name": "wheel",
            "specs": [
                [
                    "==",
                    "0.45.1"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    "==",
                    "1.1.1"
                ]
            ]
        }
    ],
    "lcname": "mailbridge"
}
        
Elapsed time: 3.39815s