Skip to content

Email Notifications

Scripts can send emails at any point during execution using the injected $notifications object. ApiMeld routes the email through the SMTP server configured in Admin → Settings → Email.

Prerequisites

SMTP must be configured before email notifications will work. See Email / SMTP for setup instructions.

Sending email from a script

PowerShell

powershell
$notifications.SendEmail(
    "[email protected]",
    "Weekly Report Ready",
    "<h1>Report complete</h1><p>1,247 records processed.</p>"
)

JavaScript / TypeScript

javascript
notifications.sendEmail(
    "[email protected]",
    "Weekly Report Ready",
    "<h1>Report complete</h1><p>1,247 records processed.</p>"
)

Python

python
notifications.send_email(
    "[email protected]",
    "Weekly Report Ready",
    "<h1>Report complete</h1><p>1,247 records processed.</p>"
)

Bash

bash
notify_email "[email protected]" "Weekly Report Ready" "Report complete. 1247 records processed."

C#

csharp
Notifications.SendEmail(
    "[email protected]",
    "Weekly Report Ready",
    "<h1>Report complete</h1><p>1,247 records processed.</p>"
);

Parameters

ParameterDescription
recipientEmail address to send to
subjectSubject line
bodyMessage body — HTML is supported

Notes

  • Email is sent asynchronously; the script does not wait for delivery confirmation
  • If SMTP is not configured or the send fails, a warning is written to the run log but the script continues
  • You can call SendEmail multiple times in a single script run — for example, once on success and once on failure using a try/catch