Skip to content

Sending over SMTP

Any application, framework or mail server that speaks SMTP can send through FrontEngine by changing only host, port and credential.

Connection details

Item Value
Host smtp-out.frontengine.net
STARTTLS port 587
Implicit TLS port 465
TLS required, minimum version 1.2
Authentication AUTH PLAIN or AUTH LOGIN
Username any value (for example, frontengine)
Password the server credential's key

TLS

  • On port 587, the connection starts in plain text and the client must issue STARTTLS before authenticating.
  • On port 465, TLS is negotiated at connection time.
  • Authentication is accepted only on a TLS connection. Versions older than TLS 1.2 are refused.

Authentication

The accepted mechanisms are PLAIN and LOGIN. CRAM-MD5 is not supported.

With the server key as the password, the username is not considered: the key identifies the server. Fill the username with any non-empty text.

Clients already using the Amazon SES convention for SMTP work too: username equal to the credential identifier (AKIA...) and password equal to the SMTP password derived from the key with the AWS algorithm. See SES compatibility.

Authentication attempts

After 20 failed authentications from the same IP address within 10 minutes, further attempts receive 454 4.7.0 until the window passes. Fix the credential instead of retrying in a loop.

Limits

Limit Value
Message size 50 MB
Recipients per message 100
  • A message over the size limit receives 552 5.3.4.
  • Recipients beyond the limit receive 452 4.5.3. Send them in another transaction.

The full list is in Limits.

Sender

Use an address on a domain verified for your server in From and MAIL FROM. An unauthorized sender may be refused with 553 5.7.1. See Set up a sending domain.

Each recipient of the transaction becomes its own message, with its own id and events.

Acceptance reply

250 2.0.0 Ok: queued as <identifier> - fsmtp

The 250 means the message was accepted and written to the queue. Delivery to the destination is asynchronous: follow it through webhooks or the message status lookup.

Test with swaks

swaks --server smtp-out.frontengine.net --port 587 --tls \
  --auth LOGIN --auth-user frontengine --auth-password "$FRONTENGINE_KEY" \
  --from [email protected] --to [email protected] \
  --header "Subject: SMTP test" --body "Test through FrontEngine."

For the implicit TLS port, replace --port 587 --tls with --port 465 --tls-on-connect.

TLS test with openssl

openssl s_client -starttls smtp -connect smtp-out.frontengine.net:587 -crlf
openssl s_client -connect smtp-out.frontengine.net:465 -crlf

After the handshake, type EHLO test.local. The reply should advertise AUTH with the PLAIN and LOGIN mechanisms.

Postfix as a smarthost

In /etc/postfix/main.cf:

relayhost = [smtp-out.frontengine.net]:587
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

In /etc/postfix/sasl_passwd (mode 600):

[smtp-out.frontengine.net]:587 frontengine:YOUR_KEY

Apply:

postmap /etc/postfix/sasl_passwd
systemctl reload postfix

Brackets in relayhost

The host appears in brackets ([host]:port) so that Postfix does not perform an MX lookup.

Application settings

In most systems (WordPress, ERPs, online stores, frameworks), fill in:

Field Value
SMTP server smtp-out.frontengine.net
Port 587
Encryption STARTTLS (or "TLS"). For "SSL", use port 465
Authentication yes
Username frontengine
Password the credential's key
Sender an address on your verified domain
import os
import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["From"] = "My Store <[email protected]>"
msg["To"] = "[email protected]"
msg["Subject"] = "Order confirmed"
msg.set_content("Your order has been confirmed.")

with smtplib.SMTP("smtp-out.frontengine.net", 587) as smtp:
    smtp.starttls()
    smtp.login("frontengine", os.environ["FRONTENGINE_KEY"])
    smtp.send_message(msg)
const nodemailer = require("nodemailer");

const transport = nodemailer.createTransport({
  host: "smtp-out.frontengine.net",
  port: 587,
  secure: false,
  requireTLS: true,
  auth: { user: "frontengine", pass: process.env.FRONTENGINE_KEY },
});

transport
  .sendMail({
    from: "My Store <[email protected]>",
    to: "[email protected]",
    subject: "Order confirmed",
    text: "Your order has been confirmed.",
  })
  .then((info) => console.log(info.response));

Next steps