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

ApplicationKey String Required The application key, corresponding to your specific web service application. This constitutes the identifier for the requested resource.
Subject String Required Subject line for the email message
Body String Required Body of the email message
From String Required From address for this email message
To String Required

 

Collection of recipient addresses for this email message
CarbonCopy String Optional Carbon Copy (CC) recipient for this email message
BlindCarbonCopy String Optional

 

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

{ “FileName”: String,

“ContentType”: String,

“FileContents”: byte[]

}

]

Optional

 

List of corresponding (EmailAttachment) objects
IsHtml Boolean Required

 

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

Success Boolean Indicated whether or not the request was successful based on the provided token and application key.
InvalidToken Boolean If the request is unsuccessful, indicates whether or not the failure was due to token.
Messages Array of String A 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."
       ]
}