The email service lets internal systems send emails via a Portal App and API key. Each request is authenticated with an API key, rate-limited, and recorded in delivery logs. Messages are queued for async delivery, and metadata can be stored alongside each send for auditing or correlation.
Portal Apps are managed from the backend:
dashboard.services.apps).portal_apps with an active or revoked status (active by default).API keys are scoped to a Portal App:
dashboard.services.apps.keys).Send email via the API using the API key in the X-API-KEY header.
Endpoint:
POST /api/email/v1/sendRequired payload fields:
to (array of email addresses, at least one)subject (string)body (string)Optional payload fields:
cc (array of email addresses)bcc (array of email addresses)reply_to (email address)metadata (object for structured tracking data)Notes:
EMAIL_SERVICE_MAX_RECIPIENTS).message_id immediately.metadata is stored with the delivery log and returned by the history endpoint so you can persist structured identifiers (ticket IDs, tenant IDs, workflow steps, etc.).Example request:
curl -X POST "https://portal.ce.pdn.ac.lk/api/email/v1/send" \
-H "Content-Type: application/json" \
-H "X-API-KEY: <your-api-key>" \
-d '{
"to": ["user@example.com"],
"subject": "Welcome",
"body": "Your account is ready.",
"metadata": {"tenant": "engineering", "request_id": "abc-123"}
}'
You can view logs in two ways:
GET /api/email/v1/history returns logs for the Portal App bound to the API key. Optional query params: status, from_date, to_date, limit, and page.Backend UI access:
user.access.services.apps.user.access.services.email.API access:
X-API-KEY header.active.email-service limiter (60 emails per minute).Email delivery uses Laravel’s mail configuration. Set the mailer credentials in .env:
MAIL_MAILERMAIL_HOSTMAIL_PORTMAIL_USERNAMEMAIL_PASSWORDMAIL_ENCRYPTIONMAIL_FROM_ADDRESSMAIL_FROM_NAMEEmail-service defaults are defined in config/email-service.php. The most commonly used overrides are:
EMAIL_SERVICE_FROM (fallback sender)EMAIL_SERVICE_QUEUE (queue name)EMAIL_SERVICE_RATE_LIMITEMAIL_SERVICE_MAX_RECIPIENTSEMAIL_SERVICE_TEMPLATEThe OpenAPI definition for the email service is available at docs/api/email.json. See the schema at ../api/email.json.