Skip to content

Sending email

Tradehall emails invoices, ticket replies, sign-in links, invitations, and alerts. It can send through:

  • An SMTP server. Any provider or mail server works: SendGrid, Postmark, Mailgun, Amazon SES, Microsoft 365, Google Workspace, or your own.
  • SendGrid’s API. Use it on hosts that block outgoing SMTP ports, such as DigitalOcean and some Railway and Render plans.
  • Resend or Amazon SES’s API, which Laravel for Go has built in. These are set in the environment only.
  • The log. Emails are written to Tradehall’s log and never sent. A new install starts here.

Whichever you pick, your provider has to allow the sender address. That usually means verifying its domain with SPF and DKIM records.

Open Settings > Email, pick a mailer, fill it in, and press Send a test email. The test goes to your own address and uses what’s on the page, so you can try settings before you save them. Saving signs in to the server first, and saves nothing if that fails. The password and API key are stored encrypted with APP_KEY.

The Sender is the From address and name on every email. Saved here, it replaces MAIL_FROM_ADDRESS and MAIL_FROM_NAME.

Only roles with the Set up how Tradehall sends email permission see the page. Whoever has the mail server login can send as your business, so grant it only to owners.

Set MAIL_MAILER to choose a mailer in the environment. The environment then wins: the settings page shows what it uses and can only send a test. When MAIL_MAILER is empty or log, the settings page decides.

Variable Example Notes
MAIL_MAILER smtp smtp, sendgrid, resend, ses, or failover. Empty or log lets the settings page choose
MAIL_FROM_ADDRESS hello@example.com The sender
MAIL_FROM_NAME Acme IT Defaults to APP_NAME
MAIL_SMTP_HOST smtp.sendgrid.net Required for smtp
MAIL_SMTP_PORT 587 Defaults to 465 with tls and 587 otherwise
MAIL_SMTP_USERNAME apikey Leave empty if the server doesn’t ask for a login
MAIL_SMTP_PASSWORD
MAIL_SMTP_ENCRYPTION starttls tls (TLS from the start, port 465), starttls (required upgrade, port 587), or none. Empty uses TLS on 465, and STARTTLS elsewhere when the server offers it
SENDGRID_API_KEY SG.… Required for sendgrid. The key needs the Mail Send permission
RESEND_API_KEY re_… Required for resend

Tradehall never sends a password over a connection that isn’t encrypted, except to a server on the same machine. With none, leave the username empty, or use localhost.

  1. In SendGrid, verify your domain under Settings > Sender Authentication and add the DNS records it gives you.
  2. Create an API key under Settings > API Keys with Restricted Access and Mail Send turned on.
  3. Use SMTP with host smtp.sendgrid.net, port 587, username apikey (the literal word), and the API key as the password:
Terminal window
MAIL_MAILER=smtp
MAIL_SMTP_HOST=smtp.sendgrid.net
MAIL_SMTP_PORT=587
MAIL_SMTP_USERNAME=apikey
MAIL_SMTP_PASSWORD=SG.your-key
MAIL_FROM_ADDRESS=hello@yourdomain.com

If your host blocks port 587, try port 2525. If it blocks that too, use the API instead: MAIL_MAILER=sendgrid and SENDGRID_API_KEY=SG.your-key.

Provider Host Port Username Password
Postmark smtp.postmarkapp.com 587 Server API token The same token
Mailgun smtp.mailgun.org (smtp.eu.mailgun.org in the EU) 587 postmaster@your-domain Its SMTP password
Amazon SES email-smtp.<region>.amazonaws.com 587 SMTP username SMTP password (not your AWS keys)
Microsoft 365 smtp.office365.com 587 The mailbox address Its password; the mailbox needs SMTP AUTH turned on
Google Workspace smtp.gmail.com 587 The mailbox address An app password
Your own relay Its address 25 Empty Empty, with encryption none

Queued email is sent by the queue worker, so check that it’s running. The Monitoring page lists jobs that failed. A server that refuses an email with a 5xx code, such as a wrong password or an unverified sender, fails the job straight away, because retrying won’t help. Anything else, such as a dropped connection, is retried.