Method | Description | |
---|---|---|
__construct ( |
||
formatPayload ( array $payload ) : array | Runs the given payload through the formatting functions. | |
post ( $payload = [], $headers = [] ) : |
Send post request to transmission endpoint after formatting cc, bcc, and expanding the shorthand emails. |
Method | 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. |
public formatPayload ( array $payload ) : array | ||
$payload | array | - the request body |
return | array | - the modified request body |
public post ( $payload = [], $headers = [] ) : |
||
return | or SparkPostResponse depending on sync or async request |