SendEmail (Application-Level)

You are here:

This method helps to send email message.

Authentication

This method requires an authentication token if the access level of the application is set to Restricted.

Request

Target Endpoint

POST /Api/Applications/SendMail

 

Parameters

Property Name

Type

Is Required?

Description

ApplicationKeyStringRequiredThe application key, corresponding to your specific web service application. This constitutes the identifier for the requested resource.
SubjectStringRequiredSubject line for the email message
BodyStringRequiredBody of the email message
FromStringRequiredFrom address for this email message
ToStringRequired

 

Collection of recipient addresses for this email message
CarbonCopyStringOptionalCarbon Copy (CC) recipient for this email message
BlindCarbonCopyStringOptional

 

Blind Carbon Copy (BCC) recipient for this email message
Attachments[

{ “FileName”: String,

“ContentType”: String,

“FileContents”: byte[]

}

]

Optional

 

List of corresponding (EmailAttachment) objects
IsHtmlBooleanRequired

 

Whether the mail body is html code or plain text.
Request Sample (Restricted)

The sample below is a simple request to the SendMail method for a restricted application, clearly designated by the bearer token in the authorization header. The token was retrieved using an authentication request. The process of retrieving an access token is documented here.

Headers

POST /Api/Applications/SendMail HTTP/1.1
Authorization: Bearer Do3l_2l3uLdmYX76u-BufLzuuhFPOE-nRZDyU0adiFk1
Content-Type: application/json
Host: dev7.pagos.com

Body (formatted)

{
       "Subject": "Test Mail",
       "Body": "This is a test mail",
       "From": "test@pagos.com",
       "To": "test2@pagos.com",
       "CarbonCopy": "cc@pagos.com",
       "BlindCarbonCopy": "bcc@pagos.com",
       "Attachments": [],
       "IsHtml": false,
       "ApplicationKey": "a4dcfb4f0464453b928ce1d6bcfb6aa3"
}
Request Sample (Unrestricted)

Headers

POST /Api/Applications/SendMail HTTP/1.1
Content-Type: application/json
Host: dev7.pagos.com

Body (formatted)

{
       "Subject": "Test Mail",
       "Body": "This is a test mail",
       "From": "test@pagos.com",
       "To": "test2@pagos.com",
       "CarbonCopy": "cc@pagos.com",
       "BlindCarbonCopy": "bcc@pagos.com",
       "Attachments": [],
       "IsHtml": false,
       "ApplicationKey": "a4dcfb4f0464453b928ce1d6bcfb6aa3"
}
Response

Property Name

Type

Description

SuccessBooleanIndicated whether or not the request was successful based on the provided token and application key.
InvalidTokenBooleanIf the request is unsuccessful, indicates whether or not the failure was due to token.
MessagesArray of StringA list of messages, which can be used or captured for diagnostics. When requests are unsuccessful, the reason for the failure will be documented in the Messages list.
Response Sample (Success)

Headers

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Type: application/json; charset=utf-8

Body (formatted)

{
       "Success": true,
       "InvalidToken": false,
       "Messages": []
}
Response Sample (Failure)

Headers

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Type: application/json; charset=utf-8

Body (formatted)

{
       "Success": false,
       "InvalidToken": false,
       "Messages": [
             "The requested application is invalid."
       ]
}