PHP Class SimpleEmailService

Show file Open project: daniel-zahariev/php-aws-ses Class Usage Examples

Protected Properties

Property Type Description
$__accessKey AWS SES Access key
$__bulk_sending_mode Controls the reuse of CURL hander for sending a bulk of messages
$__host AWS SES Target host of region
$__secretKey AWS Secret key
$__ses_request Optionally reusable SimpleEmailServiceRequest instance
$__trigger_errors Enable/disable
$__verifyHost Controls CURLOPT_SSL_VERIFYHOST setting for SimpleEmailServiceRequest's curl handler
$__verifyPeer Controls CURLOPT_SSL_VERIFYPEER setting for SimpleEmailServiceRequest's curl handler

Public Methods

Method Description
__construct ( string $accessKey = null, string $secretKey = null, string $host = self::AWS_US_EAST_1, boolean $trigger_errors = true ) : void Constructor
__triggerError ( string $functionname, array $error ) : void Trigger an error message
deleteVerifiedEmailAddress ( string $email ) : array Removes the specified email address from the list of verified addresses.
enableVerifyHost ( $enable = true ) DEPRECATED
enableVerifyPeer ( $enable = true ) DEPRECATED
getAccessKey ( ) : string Get AWS SES auth access key
getBulkMode ( ) : boolean Get bulk email sending mode
getHost ( ) : boolean Get AWS target host
getSecretKey ( ) : string Get AWS SES auth secret key
getSendQuota ( ) : array Retrieves information on the current activity limits for this account.
getSendStatistics ( ) : array Retrieves statistics for the last two weeks of activity on this account.
getVerifyHost ( ) : boolean Get the verify host CURL mode
getVerifyPeer ( ) : boolean Get the verify peer CURL mode
listVerifiedEmailAddresses ( ) : array Lists the email addresses that have been verified and can be used as the 'From' address
sendEmail ( SimpleEmailServiceMessage $sesMessage, boolean $use_raw_request = false, boolean $trigger_error = null ) : array Given a SimpleEmailServiceMessage object, submits the message to the service for sending.
setAuth ( string $accessKey, string $secretKey ) : SimpleEmailService Set AWS access key and secret key
setBulkMode ( boolean $enable = true ) : SimpleEmailService Enable/disable bulk email sending mode
setVerifyHost ( boolean $enable = true ) : SimpleEmailService Enable/disable CURLOPT_SSL_VERIFYHOST for SimpleEmailServiceRequest's curl handler verifyHost and verifyPeer determine whether curl verifies ssl certificates.
setVerifyPeer ( boolean $enable = true ) : SimpleEmailService Enable/disable CURLOPT_SSL_VERIFYPEER for SimpleEmailServiceRequest's curl handler verifyHost and verifyPeer determine whether curl verifies ssl certificates.
verifyEmailAddress ( string $email ) : array Requests verification of the provided email address, so it can be used as the 'From' address when sending emails through SimpleEmailService.
verifyHost ( ) DEPRECATED
verifyPeer ( ) DEPRECATED

Protected Methods

Method Description
getRequestHandler ( $verb )

Method Details

__construct() public method

Constructor
public __construct ( string $accessKey = null, string $secretKey = null, string $host = self::AWS_US_EAST_1, boolean $trigger_errors = true ) : void
$accessKey string Access key
$secretKey string Secret key
$host string Amazon Host through which to send the emails
$trigger_errors boolean Trigger PHP errors when AWS SES API returns an error
return void

__triggerError() public method

{@internal Used by member functions to output errors}
public __triggerError ( string $functionname, array $error ) : void
$functionname string The name of the function that failed
$error array Array containing error information
return void

deleteVerifiedEmailAddress() public method

Removes the specified email address from the list of verified addresses.
public deleteVerifiedEmailAddress ( string $email ) : array
$email string The email address to remove
return array The request id for this request.

enableVerifyHost() public method

DEPRECATED
public enableVerifyHost ( $enable = true )

enableVerifyPeer() public method

DEPRECATED
public enableVerifyPeer ( $enable = true )

getAccessKey() public method

Get AWS SES auth access key
public getAccessKey ( ) : string
return string

getBulkMode() public method

Get bulk email sending mode
public getBulkMode ( ) : boolean
return boolean

getHost() public method

Get AWS target host
public getHost ( ) : boolean
return boolean

getRequestHandler() protected method

protected getRequestHandler ( $verb )

getSecretKey() public method

Get AWS SES auth secret key
public getSecretKey ( ) : string
return string

getSendQuota() public method

See http://docs.amazonwebservices.com/ses/latest/APIReference/API_GetSendQuota.html
public getSendQuota ( ) : array
return array An array containing information on this account's activity limits.

getSendStatistics() public method

See http://docs.amazonwebservices.com/ses/latest/APIReference/API_GetSendStatistics.html
public getSendStatistics ( ) : array
return array An array of activity statistics. Each array item covers a 15-minute period.

getVerifyHost() public method

Get the verify host CURL mode
public getVerifyHost ( ) : boolean
return boolean

getVerifyPeer() public method

Get the verify peer CURL mode
public getVerifyPeer ( ) : boolean
return boolean

listVerifiedEmailAddresses() public method

Lists the email addresses that have been verified and can be used as the 'From' address
public listVerifiedEmailAddresses ( ) : array
return array An array containing two items: a list of verified email addresses, and the request id.

sendEmail() public method

Given a SimpleEmailServiceMessage object, submits the message to the service for sending.
public sendEmail ( SimpleEmailServiceMessage $sesMessage, boolean $use_raw_request = false, boolean $trigger_error = null ) : array
$sesMessage SimpleEmailServiceMessage An instance of the message class
$use_raw_request boolean If this is true or there are attachments to the email `SendRawEmail` call will be used
$trigger_error boolean Optionally overwrite the class setting for triggering an error (with type check to true/false)
return array An array containing the unique identifier for this message and a separate request id. Returns false if the provided message is missing any required fields. @link(AWS SES Response formats, http://docs.aws.amazon.com/ses/latest/DeveloperGuide/query-interface-responses.html)

setAuth() public method

Set AWS access key and secret key
public setAuth ( string $accessKey, string $secretKey ) : SimpleEmailService
$accessKey string Access key
$secretKey string Secret key
return SimpleEmailService $this

setBulkMode() public method

Enable/disable bulk email sending mode
public setBulkMode ( boolean $enable = true ) : SimpleEmailService
$enable boolean New status for the mode
return SimpleEmailService $this

setVerifyHost() public method

It may be necessary to disable these checks on certain systems. These only have an effect if SSL is enabled.
public setVerifyHost ( boolean $enable = true ) : SimpleEmailService
$enable boolean New status for the mode
return SimpleEmailService $this

setVerifyPeer() public method

It may be necessary to disable these checks on certain systems. These only have an effect if SSL is enabled.
public setVerifyPeer ( boolean $enable = true ) : SimpleEmailService
$enable boolean New status for the mode
return SimpleEmailService $this

verifyEmailAddress() public method

After submitting this request, you should receive a verification email from Amazon at the specified address containing instructions to follow.
public verifyEmailAddress ( string $email ) : array
$email string The email address to get verified
return array The request id for this request.

verifyHost() public method

DEPRECATED
public verifyHost ( )

verifyPeer() public method

DEPRECATED
public verifyPeer ( )

Property Details

$__accessKey protected property

AWS SES Access key
protected $__accessKey

$__bulk_sending_mode protected property

Controls the reuse of CURL hander for sending a bulk of messages
protected $__bulk_sending_mode

$__host protected property

AWS SES Target host of region
protected $__host

$__secretKey protected property

AWS Secret key
protected $__secretKey

$__ses_request protected property

Optionally reusable SimpleEmailServiceRequest instance
protected $__ses_request

$__trigger_errors protected property

Enable/disable
protected $__trigger_errors

$__verifyHost protected property

Controls CURLOPT_SSL_VERIFYHOST setting for SimpleEmailServiceRequest's curl handler
protected $__verifyHost

$__verifyPeer protected property

Controls CURLOPT_SSL_VERIFYPEER setting for SimpleEmailServiceRequest's curl handler
protected $__verifyPeer