Skip to content

Emails ​

Send the site's email through your SMTP server, with a test email and a log of every email sent — WP Mail SMTP's settings are read as they are.

kitloom/emails · admins: kitloom/emails-filament, kitloom/emails-nova

Video lessons ​

Recorded in the Filament admin; the Nova admin works the same way.

The site's email: every email the site sends — contact forms, orders, bookings, comments, password resets, health alerts — goes out through the SMTP server you set up in the admin, from the address you choose, and every one is in a log with how it went. A test email shows at once whether mail works. The settings are WP Mail SMTP's: a site that sent through an SMTP server under WordPress sends through the same one here, password included. The admin is kitloom/emails-filament or kitloom/emails-nova.

Setting up mail ​

Set up email
  1. Emails → Settings → Mailer: An SMTP server.

  2. Fill in your email provider's SMTP settings: host, port, encryption, username and password. Common ones:

    ProviderHostPort, encryptionUsername / password
    SendGridsmtp.sendgrid.net587, TLSapikey / an API key
    Postmarksmtp.postmarkapp.com587, TLSthe server token / the same token
    Brevosmtp-relay.brevo.com587, TLSyour login / an SMTP key
    Mailgunsmtp.mailgun.org587, TLSthe domain's SMTP user / its password
    Amazon SESemail-smtp.<region>.amazonaws.com587, TLSSMTP credentials made in the SES console
    Gmail, Google Workspacesmtp.gmail.com587, TLSthe address / an app password
  3. Sender: the From email — an address of a domain your provider lets you send from — and the From name. Turn on Force From email when the provider accepts only its own addresses (Gmail, Outlook, most do).

  4. Save, then Send a test email (at the top of the settings page in Filament; an action of the Email Log in Nova). It goes out at once, not through the queue, and the admin says what the server answered: a wrong password, a refused address, a port the hosting blocks.

With The server's mailer chosen, emails go out as the server is set up (MAIL_MAILER in .env). On a new install that is often log: the emails are written to the log file and nobody gets them — the test email says so.

The password is encrypted with the application key before it is saved and never shown again; leave its field empty to keep it. If the application key changes, the password no longer opens: enter it again.

The sender ​

Without Force, the From email and name replace only the site's default sender — MAIL_FROM_ADDRESS and MAIL_FROM_NAME. A module that sends as someone else keeps its sender: a contact form whose mail says "From: [your-email]". With Force From email, every email goes out from your address (the sender's own address belongs in Reply-To then: Contact Form 7's mail settings have the field). Return path sends bounces — "address not found" answers — to the From email too.

The email log ​

The email log

Every email the site tries to send gets an entry: the date, the subject, From, To, Cc, Bcc, Reply-To, the mailer it went through (smtp:smtp.sendgrid.net, or the server's mailer by name), what sent it (the notification or the module's class — NewComment, OrderEmails) and the status:

  • Sent — the server took it, with the message ID it gave. Whether the email reached the inbox is the receiving server's business: a spam folder is not seen from here.
  • Failed — the server refused it or could not be reached; the error is the server's answer.
  • Not confirmed — the mailer never answered: it failed in a mailer the module does not send through (a module set to a mailer of its own in config/mail.php), or the process stopped while sending.

An email from the queue is logged when a worker sends it, not when it is queued; a failed attempt that the queue tries again gets an entry per attempt.

Keep the content keeps each email's HTML and text in the log too, so an entry shows the email and Send again sends it to the same people (without its attachments, which are never kept). It is off unless you turn it on: the content of a password reset or a sign-in code is a key to an account, and whoever may read the log reads it. Entries are deleted after Keep entries, days (30 unless set; 0 keeps them all), once a day by the scheduler; php artisan emails:prune --days=7 does it by hand.

Moving from WP Mail SMTP ​

The module reads WP Mail SMTP's option (wp_mail_smtp) as it is: the mailer, the SMTP server and the From settings work at once. The password WP Mail SMTP encrypted is opened with its key — the wp_mail_smtp_mail_key option, or WPMS_CRYPTO_KEY when wp-config.php defined it: then put the same value into .env. Saving the settings page once encrypts it kitloom's way.

Of WP Mail SMTP's other mailers, SendGrid's and Postmark's keys also sign in to their SMTP servers, and are used that way. The others (Gmail and Outlook sign-in, Mailgun's, Brevo's, Amazon SES's APIs, …) are not sent through: the settings page says which one was saved, the server's mailer sends until you set up the provider's SMTP server instead. WP Mail SMTP Pro's log is not read; its settings (on, the content, the retention) are.

The other way, WordPress does not read kitloom's password: kitloom encrypts it with the application key.

Who may ​

Manage emails opens the email log and the settings, both: whoever sets up the SMTP server could read what goes through it anyway. The setting itself is protected — only the settings page writes it, never an agent or the general settings screens: whoever changes the SMTP server reads the site's password reset emails.

For AI agents ​

With kitloom/ai: emails_log reads the log (the status, the recipients, the error; never the content), emails_test sends a test email to the address of the user the agent acts for — to nobody else. Both need Manage emails; kitloom-emails.ai.register turns them off.

Personal data ​

With kitloom/privacy, Export Personal Data lists the entries of an address (sent to it or with it as the sender) and Erase Personal Data deletes them. The emails themselves are in the mailboxes they went to.

For the developer ​

WhatWhere
The mailerkitloom-emails in mail.mailers, made mail.default at boot: its transport (SettingsTransport) reads the settings for every message, so a worker under Octane or the queue sends with what is saved now
What sent beforekitloom-emails.fallback, else the mail.default the module found (MAIL_MAILER)
The settingsoption wp_mail_smtp (EmailsOptions), read by MailSettings; the password a Laravel encrypted payload, or WP Mail SMTP's sodium box
The From rules, the loglisteners of Laravel's MessageSending and MessageSent, for every mailer (Sender, MailLog)
The logtable email_log (the site's table prefix in front), model Kitloom\Emails\Models\Email
Consoleemails:test <address>, emails:prune [--days=]
Configurationconfig/kitloom-emails.php

KITLOOM_EMAILS_DEFAULT=false leaves mail.default alone: the From rules and the log still apply to every mailer, the SMTP settings only to mail sent through the kitloom-emails mailer by name. A test that reads the array transport reads app('mail.manager')->mailer('array'): the default mailer is the module's.

What the application overrides ​

  • The model: ModelRegistry::use(Email::KEY, App\Models\Email::class) in a provider of the application; the package's own is used only when the key is free, and the admins read the class from the registry.
  • The admin sections: kitloom-emails.filament.register and kitloom-emails.nova.register turn them off (php artisan vendor:publish --tag=kitloom-emails-config).
  • kitloom-emails.schedule, kitloom-emails.privacy.register, kitloom-emails.ai.register: the daily pruning, the personal data and the agent tools.

Tests ​

From the application that installs the package: php vendor/bin/phpunit --testsuite Emails.

kitloom — modules and themes for Laravel.
Pricing · Services · License · Refunds · Privacy · Community · [email protected]