API – Sending Emails


This article explains how to send emails using the API, but this can also be done through the UI.

Sending an Email

Before sending an email, you first need to create an email tool entity. You can create an email tool entity by sending a POST request to the endpoint shown below.

POST https://loanpro.simnang.com/api/public/api/1/email.tool/next

Here is what the body of the request needs to include.

"emailSubject":"Subject Line",
"emailContent":"This is an email from [[v('tenant-name')]].",

The body of the request will have the following values:

  • companyEmailId – The ID of the company email to use in the “From” field. This ID isn't found within the UI, but you can find it by sending a GET request to the 'Tenants' endpoint like this:
    • GET https://loanpro.simnang.com/api/public/api/1/odata.svc/Tenants({TenantID})/CompanyEmails
  • emailSubject – The subject of the email
  • emailContent – The content of the email
  • loans – The array of loan IDs associated with the customer you want to send the email to.

A successful response will look like the following:

"d": {
"success": true


This response means that sending the email was successful. If there was an error, then the response would look similar to the following:

"error": {
"message": "Catchable Fatal Error: Argument 1 passed to Entity\\EmailTool\\EmailTool::linkLoan()
must be an instance of Entity\\Loan, null given, called in /home/deploy/codedeploy/webroot/api/module/Tools/src/Tools/Controller/
EmailToolController.php on line 123 and defined in /home/deploy/codedeploy/webroot/api/entities/Entity/EmailTool/EmailTool.php line 563",
"type": "ContextErrorException",
"code": 0

The error shown above signifies an invalid loan ID (ie. the loan ID given does not exist).

If an email fails, it will be reprocessed to send again.

How did we do?

Powered by HelpDocs (opens in a new tab)