Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.
pip install smtpcom
Examples how to send an email via SMTP.com API, more examples for sending can be found here:
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)
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)
You can find additional examples covering all API calls in the examples folder.
FAQs
Smtp.com library for Python
We found that smtpcom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.