Add a template
Post /settings/templates
Parameters:
| Name | Description | Type | Mandatory | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| description | Template description | String | Yes | ||||||||||||
| from |
|
Struct | Yes | ||||||||||||
| htmlContent | Html content | String | Yes | ||||||||||||
| textContent | Text content | String | Yes |
Response:
| Name | Description | Type | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| templates |
|
Struct |
Programming language:
Request exemple:
{
"description": "description du template",
"from": {
"address": "from@example.com",
"personalName": "Sender name"
},
"subject": "Message subject",
"htmlContent": "html content",
"textContent": "text content"
}
Response exemple:
{
"id": "g65r4g64h65tr47h678th11d",
"templateName": "description-du-template",
"description": "Description du template",
"from": {
"address": "from@example.com"
"personalName": "Sender name"
},
"subject": "Message subject",
"htmlContent": "html content",
"textContent": "text content",
"createdAt": 1447938089,
"updatedAt": 1447938089
}
Code example:
curl -X POST -d '{"description":"description du template","from":{"address":"from@example.com","personalName":"Sender name"},"subject":"Message subject","htmlContent":"html content","textContent":"text content"}' -H "Content-Type: application/json" -H "X-Tipimail-ApiUser:YOUR_SMTP_USERNAME" -H "X-Tipimail-ApiKey:YOUR_SMTP_KEY" https://api.tipimail.com/v1/settings/templates
require 'vendor/autoload.php';
$tipimail = new Tipimail\Tipimail('YOUR_SMTP_USERNAME', 'YOUR_API_KEY');
try {
$description = 'Description';
$fromAddress = 'from@example.com';
$fromPersonalName = 'From Personal Name';
$subject = 'Subject';
$htmlContent = 'html content';
$textContent = 'text content';
$result = $tipimail->getSettingsService()->getTemplatesService()->add($description, $fromAddress, $fromPersonalName, $subject, $htmlContent, $textContent);
var_dump($result);
}
catch(Tipimail\Exceptions\TipimailException $e) {
echo 'Exception received :', $e->getMessage(), "\n";
}