Composes an email message based on input data, and then immediately queues the message for sending.
If you have not yet requested production access to Amazon SES, then you will only be able to send email to and from verified email addresses and domains. For more information, go to the Amazon SES Developer Guide.
The total size of the message cannot exceed 10 MB.
Amazon SES has a limit on the total number of recipients per message: The combined number of To:, CC: and BCC: email addresses cannot exceed 50. If you need to send an email message to a larger audience, you can divide your recipient list into groups of 50 or fewer, and then call Amazon SES repeatedly to send the message to each group.
For every message that you send, the total number of recipients (To:, CC: and BCC:) is counted against your sending quota - the maximum number of emails you can send in a 24-hour period. For information about your sending quota, go to the “Managing Your Sending Activity” section of the Amazon SES Developer Guide.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
Required |
The identity’s email address. |
|
|
|
Required |
The destination for this email, composed of To:, CC:, and BCC: fields.
|
|
|
|
Required |
The message to be sent.
|
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
|---|---|
|
A |
Examples
Send a simple plain-text email (US-ASCII).
// Instantiate the class
$email = new AmazonSES();
$response = $email->send_email(
'no-reply@amazon.com', // Source (aka From)
array('ToAddresses' => array( // Destination (aka To)
'nobody@amazon.com'
)),
array( // Message (short form)
'Subject.Data' => 'Email Test ' . time(),
'Body.Text.Data' => 'This is a simple test message ' . time()
)
);
// Success?
var_dump($response->isOK());
Result:
bool(true)
Send a simple plain-text email (longer form).
Depending on how complex your mail settings are, it may be easier to use the shorter form (above) or the longer form (below).
// Instantiate the class
$email = new AmazonSES();
$response = $email->send_email(
'no-reply@amazon.com', // Source (aka From)
array( // Destination (aka To)
'ToAddresses' => array(
'nobody@amazon.com',
'nobody@amazon.com'
),
'CcAddresses' => 'nobody@amazon.com',
'BccAddresses' => 'no-reply@amazon.com'
),
array( // Message (long form)
'Subject' => array(
'Data' => 'émåîl tést ' . time(),
'Charset' => 'UTF-8'
),
'Body' => array(
'Text' => array(
'Data' => 'Thîs îs å plåîn téxt, ünîcødé tést méssåge ' . time(),
'Charset' => 'UTF-8'
),
'Html' => array(
'Data' => '<p><strong>Thîs îs ån HTML, ünîcødé tést méssåge ' . time() . '</strong></p>',
'Charset' => 'UTF-8'
)
)
),
array( // Optional parameters
'ReplyToAddresses' => array('no-reply@amazon.com', 'nobody@amazon.com')
)
);
// Success?
var_dump($response->isOK());
Result:
bool(true)
Related Methods
Source
Method defined in services/ses.class.php | Toggle source view (26 lines) | View on GitHub

