Skip to Content
Pet Adopt

Email

Connect an SMTP server, test it, and design the emails the site sends in the email builder.

Email is built in. The site sends through any SMTP server (the standard way mail servers accept messages, which every email provider offers), and every email it sends comes from a template you can design in a drag-and-drop email builder.

Both live on the Email screen, under Settings in the admin:

  • Sending: the SMTP server and the sender.
  • Templates: the system emails and your own templates.

Admins and developers change them; audit can view them.

What uses email

FeatureWith emailWithout email
InvitesThe invite link is emailedThe admin gets the link to copy
Password resetPeople ask for a link on the reset pageOnly an admin's reset link
Confirmed emailsEvery account must confirm its address before changing anythingThe rule is paused
Changing your emailYourself, with a confirmation linkOnly an admin can change it
Account deletionThe person gets the date by emailNothing is sent
FormsTeam notifications and visitor confirmationsResponses are stored; no emails

Most of the account features depend on it, so set it up early.

Setting up sending

On Email → Sending, fill in your provider's SMTP details:

FieldWhat to enter
ServerThe host name, such as smtp.example.com, without https:// or a port
PortThe port your provider gives. Left empty, the usual port for the security choice is used
SecuritySTARTTLS (usually port 587, the default), SSL/TLS (usually port 465), or None (not encrypted; local test servers only)
User name and passwordFrom your provider. The password is stored encrypted and never sent back to a browser: leave the box empty to keep the saved one, or remove it
Sender name and addressWho the emails come from. The address is required
Reply-toOptional: where replies go

Then press Send a test email (see Test emails).

  • Saving is recorded in the activity log, naming the fields that changed but never their values.
  • The password is encrypted with a key made from BETTER_AUTH_SECRET. If that secret changes, the screen asks for the password again.
  • Unconfirmed accounts can still save these settings and send a test, so a wrong setting can't lock everyone out.

A saved password belongs to its server

Changing the server needs the password typed again, or removed. Otherwise someone who can edit the settings, but never saw the password, could have it sent to a server of their own. When the password comes from SMTP_PASSWORD, the server can only change through SMTP_HOST.

The mail server must be public

A server typed on the screen must be on the public internet: the site looks the name up, refuses private network addresses, and connects to the address it checked. This matters when a site's admin isn't the person who runs the server (see Hosting a site for someone else).

Not checked:

  • a server set with SMTP_HOST (set by whoever runs the server);
  • any server, when SMTP_PRIVATE_ADDRESSES=1 is set;
  • a server on the same machine (localhost) outside production, such as Mailpit.

In production, a mail server on the same machine typed on the screen is refused: set it with SMTP_HOST, or set SMTP_PRIVATE_ADDRESSES=1.

Environment variables

Environment variables can set or override any field. Fields they set show read-only on the screen with the variable's name, and saving ignores them.

VariableSets
SMTP_HOSTThe server
SMTP_PORTThe port, 1 to 65535
SMTP_SECURITYstarttls, tls or none
SMTP_USERThe user name
SMTP_PASSWORDThe password, taken exactly as written (spaces included)
EMAIL_FROMThe sender: an address, or a name and an address, such as Pet Adopt <no-reply@example.com>
EMAIL_REPLY_TOThe reply-to address
SMTP_PRIVATE_ADDRESSES1 lets a server typed on the screen be on a private network

A value that isn't valid (a port that isn't a number, say) is listed as a problem on the screen.

SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURITY=starttls
SMTP_USER=your-user-name
SMTP_PASSWORD=your-smtp-password
EMAIL_FROM="Pet Adopt <no-reply@example.com>"

Sending through a plugin instead

Some hosts block SMTP ports. A plugin can provide its own sender (for example through an email provider's web API), and when it is ready it is used instead of SMTP. A site has at most one. See Email senders if you write one.

Test emails

Send a test email on Email → Sending sends the Test email system email to any address you type.

  • Who: admins and developers.
  • Limit: 5 per 15 minutes per person, shared with the email builder's Send test.
  • No limit with a local server: when the SMTP server is on the same machine (such as Mailpit), nothing leaves it, so tests aren't limited. The limit stays whenever a plugin does the sending.
  • When it fails, the screen shows the mail server's own explanation, such as an unverified domain or a wrong password.

Test emails aren't recorded in the activity log.

Mailpit for development

In development, use Mailpit: a mail server that delivers nothing, so every email the site sends lands in its inbox instead.

docker compose up -d mailpit
  • The inbox is at http://localhost:8025.

  • The server accepts any mail, and any user name and password, on port 1025.

  • Point the site at it on Email → Sending (server localhost, port 1025, security None), or with:

    SMTP_HOST=localhost
    SMTP_PORT=1025
    SMTP_SECURITY=none
    EMAIL_FROM="Pet Adopt <no-reply@pet-adopt.test>"
  • Messages are kept on disk, so restarts and docker compose down / up keep the inbox; the oldest go once there are more than 500. docker compose down -v wipes them.

Both ports listen on 127.0.0.1 only.

Email templates

Email → Templates lists every email the site can send, in one table: the system emails first, then your templates in name order.

Purposes and placeholders

Every email has a purpose, which decides the placeholders it can use. A placeholder is a word in double curly brackets, such as {{name}}, that is replaced with the real value when the email is sent. Every email can use {{siteName}} and {{siteUrl}}; the builder lists the rest under Placeholders.

System emails

The site's own emails. Each is edited in place (there is one of each), and Restore default brings back the built-in version. Last edited shows Never for one that was never changed.

EmailSent whenPlaceholders
Password resetSomeone asks for a reset link on the reset page{{name}}, {{resetLink}} (required), {{minutes}}
InvitationAn admin adds someone with "Email an invite"{{name}}, {{inviteLink}} (required), {{inviterName}}, {{role}}, {{days}}
Confirm your emailSomeone asks to confirm their email from the banner{{name}}, {{confirmLink}} (required), {{hours}}
Confirm new emailSomeone changes their own email; goes to the new address{{name}}, {{confirmLink}} (required), {{newEmail}}, {{hours}}
Email change noticeGoes to the old address when someone asks to change their email, and to both when an admin changes it{{name}}, {{oldEmail}}, {{newEmail}}, {{changedBy}}
Account deletionSomeone asks to delete their own account{{name}}, {{date}}, {{days}}
Test emailSend a test email on Email → Sending{{senderName}}

An email with a required placeholder can't be saved without it, so a reset email always carries its link.

Your own templates

Make as many as you like. New template asks for a name and a type:

  • Team notification: sent to your team when something comes in, such as a form response. It can list the details, with the Details block.
  • Message to a visitor: sent to someone outside the team, such as a confirmation after they fill in a form. It never repeats what they typed, and has no Details block: anyone can type any address into a public form, so it must not echo their text.

Both can use {{title}}: what the email is about, such as the form's name.

A template is used only where something picks it, for example a form's notification. So unused templates are fine. From the table you can Edit, Rename, Copy and Delete a template. Deleting one never stops an email: whatever picked it falls back to the plugin's default, or the built-in template.

The table shows, for each template:

  • its type;
  • Used by: which forms (or other plugin features) pick it, with links;
  • Created by: the person who made it (blank for system emails and plugin defaults);
  • when it was last edited.

Plugin defaults

Plugins can bring templates of their own, marked Default. The form builder brings Form response and Form confirmation. A plugin's emails use its defaults whenever nothing else is picked.

  • You can edit and rename them.
  • You can't delete them.
  • Restore default brings back the plugin's layout once you have changed it.

The email builder

Edit on a template opens the email builder, a drag-and-drop editor like the page builder.

Blocks:

BlockWhat it is
HeadingLarge or medium text
TextParagraphs; a blank line starts a new one. Normal or small
ButtonA link styled as a button, solid or outline
ImageAn image from the media library, full or half width, with an optional link and a description for people who can't see images
Two columnsLeft and right, each holding other blocks (no columns inside columns). They stack on phones
DividerA line
SpaceSmall, medium or large
DetailsTeam notifications only: the label and value pairs the plugin sends, such as a form's answers

Most blocks have an alignment (left, centre, right). A template holds up to 60 blocks.

Links in buttons and images can be:

  • a web address (https://… or http://…);
  • a path on the site (/about);
  • {{siteUrl}}, with or without a path after it;
  • the email's own one-time link ({{resetLink}}, {{inviteLink}} or {{confirmLink}}), where its purpose has one.

The email's settings (with no block selected):

  • Subject.
  • Preview text: shown after the subject in most inboxes.
  • Footer.
  • The logo (see below).

Saving and testing:

  • Save checks the layout and lists anything to fix at the top right. There is no autosave: leaving the builder (or closing the tab) with unsaved changes asks first.
  • Send test sends the unsaved layout to the address in Send test to (yours to start with), filled with sample values. It counts towards the test email limit.
  • Audit can open the builder read-only.
  • Changes are recorded in the activity log.

Every email can start with the site's logo, from Site settings (or the site's name, when there is no logo).

OptionChoices
Logo at the topShow or hide
Logo sizeSmall (32 px high), medium (48 px) or large (64 px)
Logo alignmentLeft, centre or right
Logo links to the siteYes or no
Site's name with the logoShow or hide
Name and logo layoutLogo then name, name then logo, logo above name, or name above logo

A template saved before these options existed keeps its look: logo shown, medium, centred, no link and no name.

How emails are sent

What you design is what is sent: the builder's canvas shows the same HTML.

  • Email-safe HTML: tables and inline styles in a 600 px layout, in the theme's colours, plus a plain text copy.
  • Phones: two columns stack on small screens.
  • Classic Outlook gets a fixed-width layout and buttons that work there; rounded corners and stacking are lost in it.
  • Everything typed is escaped, so text can't turn into HTML.

There is no phone-width preview in the builder; the fixed 600 px layout stacks its columns on small screens.

WebP images in email

Classic Outlook and some older email apps can't show WebP images. So a WebP image in an email (the logo or an Image block) is linked as a PNG copy at /media/email/<name>.png, instead of the original.

  • Lossless: the copy loses nothing from the picture. An animated image keeps its first frame.
  • Made once: on the first request, then kept in upload storage beside the original, and deleted with it.
  • Other formats (JPEG, PNG, GIF), and the builder's canvas, use the original.

On this page