Send Email
Learn how to send messages with postpress.
Feature available for: Google, Microsoft, IMAP.
Send an email
Use the POST /emails method, or use the appropriate SDK method, to send an email to every recipient.
curl --request POST \
--url https://api.postpress.ai/api/v1/emails \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--form account_id=kzAxdybMQ7ipVxK1U6kwZw \
--form 'subject=Hello from postpress' \
--form 'body=Hello, this is a test email from postpress' \
--form 'to=[
{
"display_name": "John Doe",
"identifier": "john.doe@gmail.com"
}
]' \
--form 'cc=[
{
"display_name": "Jane Doe",
"identifier": "jane.doe@gmail.com"
}
]'Send attachments
You can provide an additional attachments field in the request body to send attachments along with your email.
curl --request POST \
--url https://api.postpress.ai/api/v1/emails \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--form account_id=kzAxdybMQ7ipVxK1U6kwZw \
--form 'subject=Hello from postpress' \
--form 'body=Hello, this is a test email from postpress' \
--form 'to=[
{
"display_name": "John Doe",
"identifier": "john.doe@gmail.com"
}
]' \
--form 'attachments=@C:\Documents\cute_dog.png'Send with custom headers
You can set additional custom headers using the "X-" syntax.
curl --request POST \
--url https://api.postpress.ai/api/v1/emails \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--form account_id=kzAxdybMQ7ipVxK1U6kwZw \
--form 'subject=Hello from postpress' \
--form 'body=Hello, this is a test email from postpress' \
--form 'to=[
{
"display_name": "John Doe",
"identifier": "john.doe@gmail.com"
}
]' \
--form 'cc=[
{
"display_name": "Jane Doe",
"identifier": "jane.doe@gmail.com"
}
]' \
--form 'custom_headers=[
{
"name": "X-My-Custom-Header",
"value": "Example value"
}
]'Reply to an email
You can set the additional parameter reply_to with the provider_id of an email.
curl --request POST \
--url https://api.postpress.ai/api/v1/emails \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--form account_id=kzAxdybMQ7ipVxK1U6kwZw \
--form 'subject=Re: Hello from postpress' \
--form 'body=Hello, this is a test reply from postpress' \
--form 'to=[
{
"display_name": "John Doe",
"identifier": "john.doe@gmail.com"
}
]' \
--form 'reply_to=X4R9___qXQKIu80oAF0lJA'When replying to an email you can either reply with the exact same subject or add one of the following prefixes followed by a space: Re:, Re :, RE:, RE :, re:, re :.
Personalize "from"
You can set the additional parameter from with your display name and/or alias configured on your provider.
curl --request POST \
--url https://api.postpress.ai/api/v1/emails \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--form account_id=kzAxdybMQ7ipVxK1U6kwZw \
--form 'subject=Hello from postpress' \
--form 'body=Hello, this is a test email from postpress' \
--form 'from={
"display_name": "Jake Doe",
"identifier": "myalias.doe@mycompany.com"
}' \
--form 'to=[
{
"display_name": "John Doe",
"identifier": "john.doe@gmail.com"
}
]' \
--form 'cc=[
{
"display_name": "Jane Doe",
"identifier": "jane.doe@gmail.com"
}
]'Tracking options
You can receive a webhook when an email is read or a link is clicked.
curl --request POST \
--url https://api.postpress.ai/api/v1/emails \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--form account_id=kzAxdybMQ7ipVxK1U6kwZw \
--form 'subject=Hello from postpress' \
--form 'body=Hello, this is a test email from postpress' \
--form 'to=[
{
"display_name": "John Doe",
"identifier": "john.doe@gmail.com"
}
]' \
--form 'cc=[
{
"display_name": "Jane Doe",
"identifier": "jane.doe@gmail.com"
}
]' \
--form 'tracking_options={
"opens": true,
"links": true,
"label": "myownid"
}'Send a plain text email
curl --request POST \
--url https://api.postpress.ai/api/v1/emails \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--form account_id={YOUR_ACCOUNT_ID} \
--form 'subject=Hello from postpress' \
--form-string $'body=Hello,\n\nthis is a plain text email from postpress' \
--form 'to=[
{
"display_name": "John Doe",
"identifier": "john.doe@gmail.com"
}
]' \
--form 'cc=[
{
"display_name": "Jane Doe",
"identifier": "jane.doe@gmail.com"
}
]' \
--form-string 'custom_headers=[{"name": "Content-Type", "value": "text/plain; charset=utf-8"}]'