Create a template
public createTemplate ( string $name, string $subject, string $htmlBody, string $textBody ) : Postmark\Models\DynamicResponseModel | ||
$name | string | The friendly name for this template. |
$subject | string | The template to be used for the 'subject' of emails sent using this template. |
$htmlBody | string | The template to be used for the 'htmlBody' of emails sent using this template, optional if 'textBody' is not NULL. |
$textBody | string | The template to be used for the 'textBody' of emails sent using this template, optional if 'htmlBody' is not NULL. |
리턴 | Postmark\Models\DynamicResponseModel |
function testClientCanSendMailWithTemplate() { $tk = parent::$testKeys; $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); $result = $client->createTemplate('test-php-template-' . date('c'), "{{subject}}", "Hello <b>{{name}}</b>!", "Hello {{name}}!"); $emailResult = $client->sendEmailWithTemplate($tk->WRITE_TEST_SENDER_EMAIL_ADDRESS, $tk->WRITE_TEST_EMAIL_RECIPIENT_ADDRESS, $result->templateid, array("subjectValue" => "Hello!")); $this->assertEquals(0, $emailResult->ErrorCode); }