Files
natascha-rieter.nl-user/plugins/email/api-docs/02.test/api-endpoint.md
T
2026-04-18 23:38:26 +02:00

2.0 KiB

title, template, taxonomy, api
title template taxonomy api
Test Email api-endpoint
category
docs
method path description parameters request_example response_example response_codes
POST /email/test Send a test email to verify that the email plugin is correctly configured. Sends a simple HTML email with a timestamp. Useful for validating SMTP settings, DNS, and deliverability.
name type required description
to string false Recipient email address. Defaults to the email plugin's configured "to" address.
{ "to": "admin@example.com" } { "data": { "message": "Test email sent successfully.", "to": "admin@example.com" } }
code description
200 Test email sent successfully
code description
401 Unauthorized - missing or invalid API key
code description
403 Forbidden - missing api.system.write permission
code description
422 No recipient - no "to" provided and no default configured
code description
500 Send failed - mailer transport error
code description
503 Email plugin not enabled or configured

Usage Notes

Quick Configuration Check

The simplest way to verify your email setup works end-to-end:

curl -X POST "https://yoursite.com/api/v1/email/test" \
  -H "X-API-Key: grav_your_key" \
  -H "X-Grav-Environment: localhost" \
  -H "Content-Type: application/json" \
  -d '{"to": "your@email.com"}'

Default Recipient

If you omit the to field, the test email is sent to the default recipient configured in the email plugin settings (plugins.email.to). If neither is set, the endpoint returns a 422 error.

Test Email Content

The test email contains:

  • Subject: "Grav API - Test Email"
  • Body: A simple HTML message with the send timestamp
  • From: The configured sender address from email plugin settings

This is intentionally simple to isolate transport issues from content/template problems.