Developer Function: API: Email: Send Email
Overview
You can send emails using the "「Email Sending API」".
Supported Versions
Attachments
- Pleasanter 1.2.4.0 or later
- Pleasanter .NET Framework version 0.50.267 or later
Preparation
Please create an "API Key" before performing any API operations.
Request
Send json data in the following request format:
Setting column | Value |
---|---|
HTTP Method | POST |
Content-Type | application/json |
Character Code | UTF-8 |
URL | http://{server name}/api/items/{record ID}/OutgoingMails/Send (*1) |
Body | Refer to the json data below |
(*1) Please edit the {server name} and {record ID} parts to suit your environment as appropriate. For pleasanter.net, the format is as follows: https://pleasanter.net/fs/api/items/{record ID}/OutgoingMails/Send
・Required column for json data
Column | Required | Notes |
---|---|---|
ApiVersion | Yes | |
ApiKey | Yes | |
From | - | |
To | - | |
Cc | - | |
Bcc | - | |
Title | Yes | |
Body | - | |
Attachments | - | Please set the following properties. Name: File name Base64: Base64 encoded string of the attachment ContentType: Content type |
JSON
{
"ApiVersion": 1.1,
"ApiKey": "[Set API Key]",
"From": "[FixedFrom value of Mail.json (*2)]",
"To": "[Recipient email address]",
"Cc": "[Recipient Cc email address]",
"Bcc": "[Recipient Bcc email address]",
"Title": "This is a test of the email sending API.",
"Body": "We are sending an email as a test of the email sending API.",
"Attachments": [
{
"Name": "sample1.txt",
"Base64": "c2FtcGxlMS50eHQ=...",
"ContentType": "text/plain"
},
{
"Name": "sample2.txt",
"Base64": "c2FtcGxlMi50eHQ=...",
"ContentType": "text/plain"
}
]
}
(*2) For information about FixedFrom, please refer to Mail.json.
Response
The json data in the following format will be returned and the email will be sent.
JSON
{
"Id": <record ID>,
"StatusCode": 200,
"Message": "Email sent."
}
Reference (Sending HTTP request by Postman)
(The content-type is set from Headers.)
Confirmation Column in Case of Error
・Precautions when using the API and things to check if an error occurs ・FAQ: What to check if modified configuration files or API requests (JSON format) are not recognized correctly
Related Information
- Developer Function: API: Create an API Key08.14.2024 up