SDP Email SDP EmailDocs

Mailgun Messages

SDP Email includes a Mailgun-compatible send endpoint for integrations that can point Mailgun clients at a custom host.

POST /v3/{domain}/messages

Example

curl -s --user "api:your_api_key" \
  "https://email.sdp-platform.com/v3/example.com/messages" \
  -F from="Acme <hello@example.com>" \
  -F to="delivered@example.net" \
  -F subject="Hello from SDP Email" \
  -F html="<p>Sent through the Mailgun-compatible endpoint.</p>"

Response

{
  "id": "<49a3999c-0ce1-4ea6-ab68-afcd6dc2e794@example.com>",
  "message": "Queued. Thank you."
}

Form Parameters

Parameter Type Required Description
from string Yes Sender address. Must match {domain}.
to string or repeated field Yes Recipient address or addresses. Comma-separated values are accepted.
subject string No Email subject.
html string Required without text HTML body.
text string Required without html Plain text body.
cc string or repeated field No Carbon copy recipients.
bcc string or repeated field No Blind carbon copy recipients.
h:Reply-To string No Reply-To address.
h:* string No Custom headers.
attachment file or files No File attachments.

Notes

The endpoint supports Mailgun-style basic auth with username api and the SDP Email API key as the password.

Laravel Integration

Because the endpoint is Mailgun-compatible, you can use Laravel's built-in Mailgun mailer without any custom code — just point it at SDP Email.

1. Update your .env

Add or change the following values in your Laravel application's .env file:

# Tell Laravel to send mail through the Mailgun driver.
# This is the value most people forget — mail will not use SDP Email until it is set.
MAIL_MAILER=mailgun

# Your SDP Email sending domain (replace the placeholder).
MAILGUN_DOMAIN=your-domain.com

# Your SDP Email API key (replace the placeholder).
MAILGUN_SECRET=your_api_key_here

# SDP Email Mailgun-compatible host for this deployment.
MAILGUN_ENDPOINT=email.sdp-platform.com

Only three lines need real values from you:

  • MAIL_MAILER — set to mailgun so Laravel routes outbound mail to SDP Email instead of the default driver. Do not leave this as smtp/log.
  • MAILGUN_DOMAIN — replace your-domain.com with a domain you have already onboarded and enabled for sending. See Onboard a Domain and Enable Sending. The domain must be sending-active or requests will be rejected.
  • MAILGUN_SECRET — replace your_api_key_here with an API key that has the sending scope. Create one in the SDP Email dashboard; see API Keys. The full key is shown only once at creation, so copy it immediately.

MAILGUN_ENDPOINT is the host of this SDP Email deployment (email.sdp-platform.com).

2. Confirm config/services.php

Do not skip this step. Open your config/services.php and make sure the Mailgun block contains all four lines below — especially the endpoint line:

'mailgun' => [
    'domain' => env('MAILGUN_DOMAIN'),
    'secret' => env('MAILGUN_SECRET'),
    'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
    'scheme' => 'https',
],

Missing `endpoint` key = mail silently goes to the wrong host Many Laravel apps (older projects, or ones with a trimmed `services.php`) only have `domain` and `secret` in this block. When the `endpoint` key is missing, Laravel ignores your `MAILGUN_ENDPOINT` env value entirely and sends every message to Mailgun's real API at `api.mailgun.net` — where your SDP Email key is invalid, so sending fails. If mail is failing after step 1, this is the first thing to check.

3. Send

After clearing config cache (php artisan config:clear), any mail you send goes through SDP Email:

use Illuminate\Support\Facades\Mail;

Mail::raw('Sent through SDP Email via the Mailgun driver.', function ($message) {
    $message->from('hello@your-domain.com')
        ->to('delivered@example.net')
        ->subject('Hello from SDP Email');
});

The from address must belong to your MAILGUN_DOMAIN and, if the API key is domain-restricted, to that key's domain as well.