PHP Class SparkPost\Transmission

Inheritance: extends ResourceBase
Afficher le fichier Open project: sparkpost/php-sparkpost Class Usage Examples

Méthodes publiques

Méthode Description
__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.

Private Methods

Méthode Description
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.

Method Details

__construct() public méthode

public __construct ( SparkPost $sparkpost )
$sparkpost SparkPost

formatPayload() public méthode

Runs the given payload through the formatting functions.
public formatPayload ( array $payload ) : array
$payload array - the request body
Résultat array - the modified request body

post() public méthode

Send post request to transmission endpoint after formatting cc, bcc, and expanding the shorthand emails.
public post ( $payload = [], $headers = [] ) : SparkPostPromise
Résultat SparkPostPromise or SparkPostResponse depending on sync or async request