Skip to content

Emails fail with "Relay access denied", but test emails work

The admin sends its test email with your site's settings. Order emails are sent by the background worker, which can end up with a different set of settings. When those have no mail server login, the server refuses to relay and the job fails with "relay access denied".

Why it happens

It happens on sites with a user/env/<host>/ folder, such as user/env/shop.example.com/. When that folder exists, the admin saves the Email plugin's settings there. The worker runs from cron as the cli environment, which never reads that folder, so it uses whatever user/config/plugins/email.yaml holds.

Fix it

  1. Confirm the cause:
BASH
bin/plugin kahunacart check

The Worker environment check names the folder and the settings the worker is missing.

  1. Pick one of these:
  • Move the settings from user/env/<host>/config/plugins/email.yaml into user/config/plugins/email.yaml. This is the simplest fix for a store on one address.
  • Pin the environment by adding GRAV_ENVIRONMENT=shop.example.com to the .env file in the Grav root.
  • Pin it on the cron line:
TXT
* * * * * cd /path/to/grav && GRAV_ENVIRONMENT=shop.example.com php bin/grav scheduler 1>> /dev/null 2>&1
  1. Retry the failed jobs with Run now on KahunaCart → Operations → Jobs.

The Worker environment check goes green on the worker's next run.

More detail

Was this helpful?

More in Emails and background jobs

See all in Emails and background jobs