This API allows you to send emails using PHPMailer. You can configure all PHPMailer public properties and methods (except send) via JSON.
The API will enqueue the email for asynchronous processing.
/panel/api/mail/sendThe endpoint accepts a JSON body with the following structure:
{
"emails":[
{
"isSMTP": null,
"Host": "smtp.example.com",
"SMTPAuth": true,
"Username": "user@example.com",
"Password": "yourpassword",
"SMTPSecure": "tls",
"Port": 587,
"setFrom": { "address": "user@example.com", "name": "Sender Name" },
"addAddress": { "address": "recipient@example.com", "name": "Recipient Name" },
"Subject": "Test Email",
"Body": "This is a test email.",
"isHTML": true,
"addStringAttachment": { "string": "file contents", "filename": "file.txt", "encoding": "base64", "type": "text/plain", "disposition": "attachment" },
"callBackUrl": "callback url"
}
]
}
Host, Port, SMTPAuth) or method names (e.g., setFrom, addAddress).send method is called automatically and should not be included.The following PHPMailer methods and properties are supported. For a full list, see the PHPMailer documentation.
| Name | Type | Named Parameters / Value | Description |
|---|---|---|---|
isSMTP | method | null | Enable SMTP mode |
Host | property | string | SMTP server hostname |
SMTPAuth | property | bool | Enable SMTP authentication |
Username | property | string | SMTP username |
Password | property | string | SMTP password |
SMTPSecure | property | string ("tls" or "ssl") | Encryption system to use |
Port | property | int | SMTP port |
setFrom | method | { "address": string, "name": string (optional) } | Set sender address and name |
addAddress | method | { "address": string, "name": string (optional) } | Add recipient address and name |
addCC | method | { "address": string, "name": string (optional) } | Add CC address and name |
addBCC | method | { "address": string, "name": string (optional) } | Add BCC address and name |
addReplyTo | method | { "address": string, "name": string (optional) } | Add reply-to address and name |
Subject | property | string | Email subject |
Body | property | string | Email body (HTML or plain text) |
AltBody | property | string | Alternative plain-text body |
isHTML | property | bool | Set to true to send HTML email |
addStringAttachment | method | { "string": string, "filename": string, "encoding": "base64", "type": string, "disposition": "attachment" } | Attach file content directly (preferred over addAttachment) |
Priority | property | int | Email priority (1 = High, 3 = Normal, 5 = Low) |
CharSet | property | string | Character set (e.g. "UTF-8") |
WordWrap | property | int | Word wrap length |
addCustomHeader | method | { "name": string, "value": string } | Add a custom header |
{
"success": true,
"data": [
{
"messageId": "asd-123-adfasd",
"status": "success | error",
"email": "example@mailexample.xmp"
}
],
"message": "",
"statusCode": 200
}
send) can be set via the JSON keys.