PHP Класс SparkPost\Transmission

Наследование: extends ResourceBase
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( SparkPost $sparkpost )
formatPayload ( array $payload ) : array Runs the given payload through the formatting functions.
post ( $payload = [], $headers = [] ) : SparkPostPromise Send post request to transmission endpoint after formatting cc, bcc, and expanding the shorthand emails.

Приватные методы

Метод Описание
addListToRecipients ( array $payload, array $listName ) : array Loops through the given listName in the payload and adds all the recipients to the recipients list after removing their names.
formatBlindCarbonCopy ( array $payload ) : array Formats bcc list into recipients list.
formatCarbonCopy ( array $payload ) : array Formats cc list into recipients list and adds the CC header to the content.
formatShorthandRecipients ( array $payload ) : array Formats all recipients into the long form of [ "name" => "John", "email" => "[email protected]" ].
isEmail ( string $email ) Checks if a string is an email.
toAddressObject ( $address ) : array Takes the shorthand form of an email address and converts it to the long form.
toAddressString ( $address ) Takes the longhand form of an email address and converts it to the shorthand form.

Описание методов

__construct() публичный Метод

public __construct ( SparkPost $sparkpost )
$sparkpost SparkPost

formatPayload() публичный Метод

Runs the given payload through the formatting functions.
public formatPayload ( array $payload ) : array
$payload array - the request body
Результат array - the modified request body

post() публичный Метод

Send post request to transmission endpoint after formatting cc, bcc, and expanding the shorthand emails.
public post ( $payload = [], $headers = [] ) : SparkPostPromise
Результат SparkPostPromise or SparkPostResponse depending on sync or async request