server.messaging.sendEmail
Sends a message (sms/email) containing the server generated OTP and returns the requestId to be used by other methods.
Syntax
Copy
function server.messaging.sendEmail(to, from, message, {"provider": "FtosEmailNotificationService","subject": "test subject","cc":'[“a“,”b”]',"bcc":'[“x“,”y”]'})
| Parameter | Type | Description |
|---|---|---|
from
|
string | Email address/Phone number of the sender. |
to
|
string | Email address/Phone number of the recipient(s). |
subject |
string | Email subject (used only if the OTP is sent to an email address). |
notificationProvider
|
string |
A string defining the provider which will be used to send the email/sms. The following providers are supported: GatewayEmailOTP, CustomEmailProvider and FtosEmailNotificationService. |
notificationChannel
|
string |
The channel(sms/email) provider which will be used to send the OTP. |
Examples
In this example:
- We send an email to jane.smith@mail.com.
- The message reads: Your next payment due date is 25/02/2022..
- The message sender is MyBusiness Ltd.
- The message is sent immediately using the email service provider (GatewayEmailOTP).
Copy
server.messaging.sendEmail("jane.smith@mail.com", "MyBusiness Ltd.", "Your next payment due date is 25/02/2022.", {"provider": "GatewayEmailOTP","subject": "Payment Due Date"})