Postmark\Models\PostmarkAttachment::fromRawData PHP Метод

fromRawData() публичный статический Метод

public static fromRawData ( $data, $attachmentName, $mimeType = NULL )
    public static function fromRawData($data, $attachmentName, $mimeType = NULL)
    {
        return new PostmarkAttachment(base64_encode($data), $attachmentName, $mimeType);
    }

Usage Example

 function testClientCanSendBatchMessages()
 {
     $tk = parent::$testKeys;
     $currentTime = date("c");
     $batch = array();
     $attachment = PostmarkAttachment::fromRawData("attachment content", "hello.txt", "text/plain");
     for ($i = 0; $i < 5; $i++) {
         $payload = array('From' => $tk->WRITE_TEST_SENDER_EMAIL_ADDRESS, 'To' => $tk->WRITE_TEST_EMAIL_RECIPIENT_ADDRESS, 'Subject' => "Hello from the PHP Postmark Client Tests! ({$currentTime})", 'HtmlBody' => '<b>Hi there! (batch test)</b>', 'TextBody' => 'This is a text body for a test email.', 'TrackOpens' => true, 'Headers' => array("X-Test-Header" => "Test Header Content", 'X-Test-Date-Sent' => date('c')), 'Attachments' => array($attachment));
         $batch[] = $payload;
     }
     $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT);
     $response = $client->sendEmailBatch($batch);
     $this->assertNotEmpty($response, 'The client could not send a batch of messages.');
 }
All Usage Examples Of Postmark\Models\PostmarkAttachment::fromRawData