portal.ce.pdn.ac.lk

Email Service

Introduction

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.

How to create a Portal App

Portal Apps are managed from the backend:

How to create an API key

API keys are scoped to a Portal App:

How to send an Email

Send email via the API using the API key in the X-API-KEY header.

Endpoint:

Required payload fields:

Optional payload fields:

Notes:

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"}
  }'

How to see the email logs

You can view logs in two ways:

Access Control

Backend UI access:

API access:

Email sender configuration

Email delivery uses Laravel’s mail configuration. Set the mailer credentials in .env:

Email-service defaults are defined in config/email-service.php. The most commonly used overrides are:

OpenAPI schema

The OpenAPI definition for the email service is available at docs/api/email.json. See the schema at ../api/email.json.