PHP Class Mailgun\Mailgun

See the official documentation (link below) for usage instructions.
Show file Open project: mailgun/mailgun-php Class Usage Examples

Protected Properties

Property Type Description
$apiKey null | string
$restClient Mailgun\Connection\RestClient

Public Methods

Method Description
BatchMessage ( string $workingDomain, boolean $autoSend = true ) : BatchMessage
MessageBuilder ( ) : MessageBuilder
OptInHandler ( ) : OptInHandler
__construct ( string | null $apiKey = null, Http\Client\HttpClient $httpClient = null, string $apiEndpoint = 'api.mailgun.net', Mailgun\Deserializer\ResponseDeserializer $deserializer = null, HttpClientConfigurator $clientConfigurator = null, RequestBuilder $requestBuilder = null )
delete ( string $endpointUrl ) : stdClass
domains ( ) : Domain
get ( string $endpointUrl, array $queryString = [] ) : stdClass
post ( string $endpointUrl, array $postData = [], array $files = [] ) : stdClass
put ( string $endpointUrl, array $putData ) : stdClass
sendMessage ( string $workingDomain, array $postData, array $postFiles = [] ) : stdClass This function allows the sending of a fully formed message OR a custom MIME string. If sending MIME, the string must be passed in to the 3rd position of the function call.
setApiVersion ( string $apiVersion ) : Mailgun
setSslEnabled ( boolean $sslEnabled ) : Mailgun
stats ( ) : Api\Stats
verifyWebhookSignature ( array | null $postData = null ) : boolean This function checks the signature in a POST request to see if it is authentic.

Method Details

BatchMessage() public method

public BatchMessage ( string $workingDomain, boolean $autoSend = true ) : BatchMessage
$workingDomain string
$autoSend boolean
return Mailgun\Messages\BatchMessage

MessageBuilder() public method

public MessageBuilder ( ) : MessageBuilder
return Mailgun\Messages\MessageBuilder

OptInHandler() public method

public OptInHandler ( ) : OptInHandler
return Mailgun\Lists\OptInHandler

__construct() public method

public __construct ( string | null $apiKey = null, Http\Client\HttpClient $httpClient = null, string $apiEndpoint = 'api.mailgun.net', Mailgun\Deserializer\ResponseDeserializer $deserializer = null, HttpClientConfigurator $clientConfigurator = null, RequestBuilder $requestBuilder = null )
$apiKey string | null
$httpClient Http\Client\HttpClient
$apiEndpoint string
$deserializer Mailgun\Deserializer\ResponseDeserializer
$clientConfigurator HttpClientConfigurator
$requestBuilder RequestBuilder

delete() public method

public delete ( string $endpointUrl ) : stdClass
$endpointUrl string
return stdClass

domains() public method

public domains ( ) : Domain
return Mailgun\Api\Domain

get() public method

public get ( string $endpointUrl, array $queryString = [] ) : stdClass
$endpointUrl string
$queryString array
return stdClass

post() public method

public post ( string $endpointUrl, array $postData = [], array $files = [] ) : stdClass
$endpointUrl string
$postData array
$files array
return stdClass

put() public method

public put ( string $endpointUrl, array $putData ) : stdClass
$endpointUrl string
$putData array
return stdClass

sendMessage() public method

This function allows the sending of a fully formed message OR a custom MIME string. If sending MIME, the string must be passed in to the 3rd position of the function call.
public sendMessage ( string $workingDomain, array $postData, array $postFiles = [] ) : stdClass
$workingDomain string
$postData array
$postFiles array
return stdClass

setApiVersion() public method

public setApiVersion ( string $apiVersion ) : Mailgun
$apiVersion string
return Mailgun

setSslEnabled() public method

Deprecation: This will be removed in 3.0. Mailgun does not support non-secure connections to their API.
public setSslEnabled ( boolean $sslEnabled ) : Mailgun
$sslEnabled boolean
return Mailgun

stats() public method

public stats ( ) : Api\Stats
return Api\Stats

verifyWebhookSignature() public method

Pass an array of parameters. If you pass nothing, $_POST will be used instead. If this function returns FALSE, you must not process the request. You should reject the request with status code 403 Forbidden.
public verifyWebhookSignature ( array | null $postData = null ) : boolean
$postData array | null
return boolean

Property Details

$apiKey protected property

protected null|string $apiKey
return null | string

$restClient protected property

protected RestClient,Mailgun\Connection $restClient
return Mailgun\Connection\RestClient