Sending emails
The Send Email API enables sponsor administrators and sponsor line-of-business (LOB) users to send emails to other users such as sponsors or trading partners. Use this API to use the system default email templates for sending emails. You can also modify the system default templates and use them as custom templates. However, if you create a new template with a custom name such as ibmtemplate.xml and provides the template key as an input, the template does not work.
Keys
- emailTemplateKey - The unique key of the system default email template.
- templateArguments - Array of arguments that are provided in the email template to replace parameter values in the template.
- toAddresses - Array of unique and valid email addresses of the recipients.
- Locale - Language to be used for sending the email if the email template has a translation for that language. Value for the locale is the folder name within the default template. For example, en, de, or ja.
URL for access
The following URL pattern is used by sponsor administrators and sponsor LOB users to send emails to other users:
https://<host>:<port>/mrmws/sponsors/{sponsorContext}/sendemail
- <sponsorContext> is the sponsor context URI (short name to identify the company)
For example,
Send email API URL for PEM Portal -
https://198.51.100.0:9443/mrmws/sponsors/b2b/sendemail
Send email API URL for PEM Partner Repository -
https://198.51.100.0:9444/mrmws/sponsors/b2b/sendemail
In this example, the sponsor context is b2b.
Input
- emailTemplateKey
- toAddresses
- templateArguments
- locale
Headers
The headers for the API are as follows:
-
Accept : application/xml
-
Content-Type : application/xml
-
Accept : application/json
-
Content-Type : application/json
Sample request data
Use POST as the HTTP request method. A sample request pattern to send emails is as follows:
For example,
XML
<?xml version="1.0" encoding="UTF-8"?>
<SendEmailInput>
<emailTemplateKey>ACTIVITY_INST_CLOSE_MAIL</emailTemplateKey>
<templateArguments>
<argument>activity name</argument>
<argument>example name</argument>
</templateArguments>
<toAddresses>
<toAddress>abc@us.ibm.com</toAddress>
</toAddresses>
<locale>en</locale>
</SendEmailInput>
JSON
{
"emailTemplateKey": "ACTIVITY_INST_CLOSE_MAIL",
"toAddresses": ["abc@us.ibm.com"],
"templateArguments": ["activity name", "example name"],
“locale”: “en”
}
Processing
When the API call is completed, the API returns a status message.
The API is protected with Basic Authentication so that only Sponsor Administrators or Sponsor LOB users can send emails.