Amazon SES compatibility¶
FrontEngine accepts Amazon SES sending calls. An application that already uses the AWS SDK or CLI sends through FrontEngine by changing the endpoint and the credentials.
Compatibility covers sending. Events stay in FrontEngine's own format, through webhooks; there are no SNS-format notifications.
Supported operations¶
| API | Operation | Request |
|---|---|---|
| SES v2 | SendEmail with Simple content | POST /v2/email/outbound-emails |
| SES v2 | SendEmail with Raw content | POST /v2/email/outbound-emails |
| SES v2 | GetAccount | GET /v2/email/account |
| SES v1 (Query) | SendEmail | POST / with Action=SendEmail |
| SES v1 (Query) | SendRawEmail | POST / with Action=SendRawEmail |
| SES v1 (Query) | GetSendQuota | POST / with Action=GetSendQuota |
The base URL is https://api.frontengine.net.
Credentials and signing¶
Requests are signed with Signature Version 4 (SigV4), as on AWS:
| SDK field | Value |
|---|---|
| Access key ID | the server credential's identifier (AKIA...) |
| Secret access key | the server credential's key |
| Region | any (for example, us-east-1); the value only enters the signature |
| Endpoint | https://api.frontengine.net |
Verification rules:
- The signature goes in the
Authorizationheader (AWS4-HMAC-SHA256), with the servicesesin the scope. Thehostheader must be among the signed headers. - The client clock (
X-Amz-Date) may differ from ours by up to 15 minutes. - Not accepted: STS session tokens, presigned URLs (signature in the query string) and SigV4a.
It is the same credential
The identifier and the key are the same ones used for SMTP and for the Postal-compatible API. See Account, servers and credentials.
Examples¶
import os
import boto3
ses = boto3.client(
"sesv2",
endpoint_url="https://api.frontengine.net",
region_name="us-east-1",
aws_access_key_id=os.environ["FRONTENGINE_KEY_ID"],
aws_secret_access_key=os.environ["FRONTENGINE_KEY"],
)
resp = ses.send_email(
FromEmailAddress="My Store <[email protected]>",
Destination={"ToAddresses": ["[email protected]"]},
Content={
"Simple": {
"Subject": {"Data": "Order 1234 confirmed"},
"Body": {
"Text": {"Data": "Your order 1234 has been confirmed."},
"Html": {"Data": "<p>Your order <strong>1234</strong> has been confirmed.</p>"},
},
}
},
)
print(resp["MessageId"])
import { SESv2Client, SendEmailCommand } from "@aws-sdk/client-sesv2";
const ses = new SESv2Client({
endpoint: "https://api.frontengine.net",
region: "us-east-1",
credentials: {
accessKeyId: process.env.FRONTENGINE_KEY_ID,
secretAccessKey: process.env.FRONTENGINE_KEY,
},
});
const resp = await ses.send(
new SendEmailCommand({
FromEmailAddress: "My Store <[email protected]>",
Destination: { ToAddresses: ["[email protected]"] },
Content: {
Simple: {
Subject: { Data: "Order 1234 confirmed" },
Body: { Text: { Data: "Your order 1234 has been confirmed." } },
},
},
})
);
console.log(resp.MessageId);
export AWS_ACCESS_KEY_ID="$FRONTENGINE_KEY_ID"
export AWS_SECRET_ACCESS_KEY="$FRONTENGINE_KEY"
export AWS_DEFAULT_REGION="us-east-1"
# SES v2
aws sesv2 send-email --endpoint-url https://api.frontengine.net \
--from-email-address "[email protected]" \
--destination "[email protected]" \
--content '{"Simple":{"Subject":{"Data":"CLI test"},"Body":{"Text":{"Data":"It worked."}}}}'
# SES v1
aws ses send-email --endpoint-url https://api.frontengine.net \
--from "[email protected]" \
--destination "[email protected]" \
--message '{"Subject":{"Data":"v1 test"},"Body":{"Text":{"Data":"It worked."}}}'
aws ses get-send-quota --endpoint-url https://api.frontengine.net
Accepted fields¶
SES v2, SendEmail¶
| Field | Behavior |
|---|---|
FromEmailAddress | Sender. With Raw content, if absent, the message's From is used. |
Destination.ToAddresses, CcAddresses, BccAddresses | Recipients. |
ReplyToAddresses | Reply-To header. |
Content.Simple.Subject, Body.Text, Body.Html | Subject and bodies. At least one body is required. |
Content.Simple.Headers | Additional headers. |
Content.Simple.Attachments | Attachments with FileName and RawContent. Only ContentDisposition equal to ATTACHMENT. |
Content.Raw.Data | Complete MIME message. |
EmailTags, ConfigurationSetName | Accepted and written to the message's X-SES-MESSAGE-TAGS and X-SES-CONFIGURATION-SET headers. |
SES v1, SendEmail and SendRawEmail¶
Source, Destination.*, ReplyToAddresses, Message.Subject.Data, Message.Body.Text.Data, Message.Body.Html.Data, RawMessage.Data, Destinations, Tags and ConfigurationSetName. The ReturnPath parameter is accepted and ignored: the return address is always FrontEngine's (see Custom return path).
Behavior differences¶
- Recipient limit. At most 50 recipients per message, adding up
To,CcandBcc. Above that the answer isMessageRejected. MessageId. The response returns aMessageIdin SES's format. As in SES, the message'sMessage-IDheader is replaced with<MessageId@sender-domain>.- Raw without recipients. If the request names no recipients, the ones in the message's
To,CcandBccheaders are used. TheBccheader is removed before sending. - Quotas.
GetSendQuotaandGetAccountexist so that SDK health checks work. The values are constants andSentLast24Hoursis always zero. Do not use these operations to measure usage. - Different identifier from Postal's. The SES
MessageIdis not the numericidused in the status lookup and in webhooks. To correlate, use theMessage-IDheader, which appears asmessage_idin events.
Unsupported operations¶
These calls are refused with BadRequestException (v2) or InvalidAction (v1):
- bulk sending (
/v2/email/outbound-bulk-emails,SendBulkEmail,SendBulkTemplatedEmail); - templates (
Content.Template,SendTemplatedEmailand template management); ListManagementOptionsand contact lists;- inline attachments (
ContentDispositionother thanATTACHMENT); - identity, configuration set and suppression management through the SES API;
- any other operation outside the supported operations table.
Errors¶
In SES v2, the error comes in the HTTP code, in the x-amzn-ErrorType header and in the body {"message": "..."}. In SES v1, it comes in an <ErrorResponse> XML. The SDKs turn both into the usual exceptions.
| HTTP | v2 (x-amzn-ErrorType) | v1 (Code) | Cause |
|---|---|---|---|
| 403 | MissingAuthenticationTokenException | MissingAuthenticationToken | No Authorization header. |
| 403 | IncompleteSignatureException | IncompleteSignature | Malformed signature header, missing X-Amz-Date, or host not signed. |
| 403 | UnrecognizedClientException | InvalidClientTokenId | Unknown credential identifier. |
| 403 | InvalidSignatureException | SignatureDoesNotMatch | Wrong signature, service other than ses, or clock outside the tolerance. |
| 400 | AccountSuspendedException | AccountSendingPausedException | Server suspended. |
| 400 | BadRequestException | InvalidParameterValue | Invalid request. The message says why. |
| 400 | BadRequestException | InvalidAction | Unsupported operation. |
| 400 | MessageRejected | MessageRejected | Unauthorized sender, too many recipients, or a permanent refusal. |
| 413 | BadRequestException | InvalidParameterValue | Request too large. |
| 503 | ServiceUnavailableException | ServiceUnavailable | Temporary failure. Retry. |
| 500 | InternalFailure | InternalFailure | A failure on our side. Retry. |
Every response carries the x-amzn-RequestId header, as in SES.
SMTP the SES way¶
Clients configured with SES SMTP credentials work too: username equal to the credential identifier and password equal to the SMTP password derived from the key with the AWS algorithm, for any region. Using the key itself as the password is also accepted. See Sending over SMTP.