class Postmark extends Mailer (View source)

Sends emails to Postmark server

Properties

protected AdapterInterface $adapter from Mailer
protected string $serverToken from Mailer

Methods

__construct(AdapterInterface $adapter, string $serverToken)

No description

from Mailer
setAdapter(AdapterInterface $adapter)

No description

from Mailer
getAdapter()

No description

from Mailer
setServerToken($serverToken)

No description

from Mailer
string
getServerToken()

No description

from Mailer
Boolean
send(MessageInterface $message)

No description

from Mailer
array
getHeaders()

Return a key -> value array of headers

string[]
getFiles(MessageInterface $message)

Return an key -> value array of files

from Mailer
string
getEndpoint()

No description

string
format(MessageInterface $message)

Return a a string formatted for the correct Mailer endpoint.

handle(ResponseInterface $response)

If a Response is not successful it will be passed to this method each Mailer should then throw an HttpException with an optional ApiException to help identify the problem.

normalizeIdentity(IdentityInterface|string $identity)

No description

from Mailer
normalizeIdentities(IdentityInterface[]|string $identities)

No description

from Mailer
string
buildIdentityString(IdentityInterface[]|IdentityInterface|string $identities)

No description

from Mailer
string
getAttachmentContent(Attachment $attachment)

No description

array
processAttachments(array $attachments)

No description

Details

__construct(AdapterInterface $adapter, string $serverToken)

Parameters

AdapterInterface $adapter
string $serverToken

setAdapter(AdapterInterface $adapter)

Parameters

AdapterInterface $adapter

AdapterInterface getAdapter()

Return Value

AdapterInterface

setServerToken($serverToken)

Parameters

$serverToken

string getServerToken()

Return Value

string

Boolean send(MessageInterface $message)

Parameters

MessageInterface $message

Return Value

Boolean

protected array getHeaders()

Return a key -> value array of headers

example: array('X-Header-Name' => 'value')

Return Value

array

protected string[] getFiles(MessageInterface $message)

Return an key -> value array of files

example: array('attachmentname.jpg' => '/path/to/file.jpg')

Parameters

MessageInterface $message

Return Value

string[]

protected string getEndpoint()

Return Value

string

protected string format(MessageInterface $message)

Return a a string formatted for the correct Mailer endpoint.

Postmark this is Json, SendGrid it is a urlencoded parameter list

Parameters

MessageInterface $message

Return Value

string

protected handle(ResponseInterface $response)

If a Response is not successful it will be passed to this method each Mailer should then throw an HttpException with an optional ApiException to help identify the problem.

Parameters

ResponseInterface $response

Exceptions

ApiException
HttpException

protected IdentityInterface normalizeIdentity(IdentityInterface|string $identity)

Parameters

IdentityInterface|string $identity

Return Value

IdentityInterface

protected IdentityInterface[] normalizeIdentities(IdentityInterface[]|string $identities)

Parameters

IdentityInterface[]|string $identities

Return Value

IdentityInterface[]

protected string buildIdentityString(IdentityInterface[]|IdentityInterface|string $identities)

Parameters

IdentityInterface[]|IdentityInterface|string $identities

Return Value

string

protected string getAttachmentContent(Attachment $attachment)

Parameters

Attachment $attachment

Return Value

string

protected array processAttachments(array $attachments)

Parameters

array $attachments

Return Value

array An array containing arrays of the following format: array( 'Name' => name, 'Content' => base64-encoded content, 'ContentType' => type, (optional) 'ContentID' => id, )