Python
In order to send an email using the service from vanilla Python we currently use the requests library.
Note
We will be creating a package to make this easier in the future.
import requests
# Define the API endpoint and API key
url = "https://api.notifiedby.com/v1/email/send/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
}
data = {
"recipient": "YOU@TESTEMAIL",
"subject": "email from API",
"body": "<h1>Email from API</h1><p>This is an <strong>HTML</strong> email body.</p>",
"plain_body": "This is the plain text version of the email body.",
}
# Make the POST request
response = requests.post(url, headers=headers, data=data)
# Print the response
print(response.status_code)
print(response.text)
Example with Encryption Key
import requests
# Define the API endpoint and API key
url = "https://api.notifiedby.com/v1/email/send/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Encryption-Key": "my-encryption-key",
}
data = {
"recipient": "YOU@TESTEMAIL",
"subject": "email from API",
"body": "<h1>Email from API</h1><p>This is an <strong>HTML</strong> email body.</p>",
"plain_body": "This is the plain text version of the email body.",
}
# Make the POST request
response = requests.post(url, headers=headers, data=data)
# Print the response
print(response.status_code)
print(response.text)
YOU@TESTEMAIL should be set to your email or your customer’s email address.