Send Email (v2)

Use the Send Mail (v2) REST API to send an email to specified recipients, optionally attaching files from EPM Cloud. You can attach any file up to 10 MB in size, other than a snapshot, that is available in EPM Cloud environments. This API can be incorporated into REST API programs and scripts to notify users of various conditions or to send reports.

This topic describes the simplified v2 version of this REST API. This version contains all parameters in the payload and does not require URL encoding while calling the REST APIs. This makes the v2 API easier to use. This API is backwards compatible.

The API is asynchronous and returns the Job ID. Use the job status URI to determine whether the process is complete. The presence of status -1 in the response indicates that the process is in progress. Any non-zero status except -1 indicates failure.

This REST API is version v2.

Required Roles

Required Roles

Service Administrator

REST Resource

POST /interop/rest/v2/mails/send

Note:

Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for EPM Cloud REST APIs. Using this REST API requires prerequisites. See Prerequisites.

Table 9-104 Tasks

Task Request REST Resource
Trigger sendmail POST /interop/rest/v2/mails/send
Retrieve sendmail status GET /interop/rest/v2/status/jobs/777

Request

Supported Media Types: application/json

The following table summarizes the request parameters.

Table 9-105 Parameters

Name Description Type Required Default
to The recipient email addresses separated by semi-colons Payload Yes None
subject The subject for the email Payload Yes None
body The body of the email providing details. Payload Yes None

parameters

Parameters for this REST API Payload No None
attachments One or more file names separated by commas to be added as attachments to the email, for example, outbox/Errorfile.txt or inbox/Errorfile2.txt

You can attach any file up to 10 MB in size, other than a snapshot, that is available in EPM Cloud environments.

Payload No None

Sample URL and Payload

https://<BASE URL>/interop/rest/v2/mails/send
{
    "to": "<EMAIL_ADDRESS>",
    "subject": "EPM",
    "body": "EPM weekly email",
    "parameters": {
        "attachments":"apr/Feedback 2022-03-01 07_42_04/access_log.zip"
    }
}

Response

Table 9-106 Parameters

Name Description
details In the case of errors, details are published with the error string
status See Migration Status Codes
links Detailed information about the link
href Links to API call or status API
action The HTTP call type
rel Possible values: self or Job Status. If the value is set to Job Status, you can use the href to get the status
data Parameters as key value pairs passed in the request
items Details about the resource
links Details of the first URL to be requested to get the job details; rel is "Job Details"

Example of Response Body

{
	"status": -1,
	"items": null,
	"links": [{
		"rel": "self",
		"href": "https://<BASE URL>/interop/rest/v2/mails/send",
		"data": null,
		"action": "POST"
	}, {
		"rel": "Job Status",
		"href": "https://<BASE URL>/interop/rest/v2/status/jobs/1502357937045",
		"data": null,
		"action": "GET"
	}],
	"details": null
}

Sample cURL Command

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H 'Content-Type: application/json' -d '{"subject":"SUBJECT_OF_THE_MAIL", "to":"RECIPIENT_EMAIL_ADDRESS","body":"BODY_OF_THE_MAIL","parameters":{"attachments":"NAME_OF_THE_FILE_TO_BE_ATTACHED"}}' 'https://<BASE URL>/interop/rest/v2/mails/send'
Common Functions