Send an email using a template.
public sendEmailWithTemplate ( string $from, string $to, integer $templateId, object $templateModel, boolean $inlineCss = true, string $tag = NULL, boolean $trackOpens = true, string $replyTo = NULL, string $cc = NULL, string $bcc = NULL, array $headers = NULL, array $attachments = NULL, string $trackLinks = NULL ) : Postmark\Models\DynamicResponseModel | ||
$from | string | The sender of the email. (Your account must have an associated Sender Signature for the address used.) |
$to | string | The recipient of the email. |
$templateId | integer | The ID of the template to use to generate the content of this message. |
$templateModel | object | The values to combine with the Templated content. |
$inlineCss | boolean | If the template contains an HTMLBody, CSS is automatically inlined, you may opt-out of this by passing 'false' for this parameter. |
$tag | string | A tag associated with this message, useful for classifying sent messages. |
$trackOpens | boolean | True if you want Postmark to track opens of HTML emails. |
$replyTo | string | Reply to email address. |
$cc | string | Carbon Copy recipients, comma-separated |
$bcc | string | Blind Carbon Copy recipients, comma-separated. |
$headers | array | Headers to be included with the sent email message. |
$attachments | array | An array of PostmarkAttachment objects. |
$trackLinks | string | Can be any of "None", "HtmlAndText", "HtmlOnly", "TextOnly" to enable link tracking. |
Результат | 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); }