Python Library for Quick and Easy Use of the SMTP.com v4 API.
This library provides support for the SMTP.com public API SMTP.com API v4 documentation.
Installation
Python version 3.0+ required.
Install Package
pip install smtpcom
Getting Started
Examples how to send an email via SMTP.com API, more examples for sending can be found here:
With a Helper Class
import os
from smtpcom import SMTPAPIClient
from smtpcom.helpers.mail import (
Mail,
From,
To,
Subject,
Channel,
Content,
)
# getting api key from env variable SMTPCOM_API_KEY that was present
smtpcom = SMTPAPIClient(api_key=os.environ.get("SMTPCOM_API_KEY"))
channel = "some_channel_example"
# send with html content
mail = Mail(
from_email=From("test_from@example.com"),
to_emails=To("test_to@example.com"),
subject=Subject("Test"),
channel=Channel(channel),
contents=Content(
content="<html>\n<head></head>\n<body>\nSome HTML content\n</body>\n</html>\n",
content_type="text/html",
encoding="quoted-printable",
),
)
response = smtpcom.send(mail)
print(response.status_code)
print(response.body)
print(response.headers)
Without a Helper Class
import os
from smtpcom import SMTPAPIClient
smtpcom = SMTPAPIClient(api_key=os.environ.get("SMTPCOM_API_KEY"))
channel = "some_channel_example"
# send with raw body
raw_mail_body = {
"channel": channel,
"recipients": {"to": [{"address": "test_to@example.com"}]},
"originator": {"from": {"address": "test_from@example.com"}},
"subject": "Test",
"body": {
"parts": [
{
"content": "<html>\n<head></head>\n<body>\nSome HTML content\n</body>\n</html>\n",
"type": "text/html",
"encoding": "quoted-printable",
}
]
},
}
response = smtpcom.send(raw_mail_body)
print(response.status_code)
print(response.body)
print(response.headers)
Additional Examples
You can find additional examples covering all API calls in the examples folder.
Metadata
Release files for smtpcom 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smtpcom-1.1.1.tar.gz | 19.2 kB | Without provenance | Details for smtpcom-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smtpcom-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for smtpcom-1.1.1-py3-none-any.whl |
Total release size: 44.0 kB
Release files / smtpcom-1.1.1.tar.gz
| Download URL | smtpcom-1.1.1.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7b9d645c5638403626c082e5ebffb4bb14dbad8f24cbe590e10f7706d2f9eac
|
|
BLAKE2b-256 checksum How to use checksums |
fe50104b835e2bf68a66877bf9a4530b4a0bd1a99ba57c5e0b00ece7ed882f6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|
Release files / smtpcom-1.1.1-py3-none-any.whl
| Download URL | smtpcom-1.1.1-py3-none-any.whl |
|---|---|
| Size | 24.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ca0211139337427cf37171fa27762707ba12cc2631ce0ed531ca7df00373c39
|
|
BLAKE2b-256 checksum How to use checksums |
11316655213e996a867ba703d97fbac0040c8b4c4146ade375f027eaf74e092e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.9
|
Security for smtpcom 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.