Easy Steps For Amazon SES Integration into PHP Applications

Amazon Simple Email Service is highly scalable, cost effective bulk email sending service. In this article I will be explaining how to integrate Amazon SES into your existing applications built in PHP quickly. 

  1. Sign up for Amazon SES
  2. Add a verified sender email id -  Login to AWS Management Console, Add an emailid to the verified senders list. Email would be sent to the specified address and once verified the senders email id gets added.
  3.  Once user gets added to senders list, you can send test mails to any valid email id using the AWS Console
  4. Request production access from here. Initially you will get a max Limit of 1000 mails per day and maximum of 1 email/second.
  5. Get AWS access keys - Go to http://aws.amazon.com, click Account, and then click Security Credentials. Navigate to the Access Credentials section of the page, and click the Access Keys tab.
  6. Download Amazon SES PHP class from here
  7. Sample PHP script which will send the email using Amazon SES
require_once('ses.php');
$ses = new SimpleEmailService('Access Key Here', 'Secret Key Here');
$m = new SimpleEmailServiceMessage();
$m->addTo('recipient@example.com');
$m->setFrom('user@example.com');
$m->setSubject('Hello, world!');
$m->setMessageFromString('This is the message body.');

print_r($ses->sendEmail($m));
Thats it all set to send messages using Amazon SES.
Pricing: Amazon charges $0.10 for 1000 messages and $0.12 per GB of attachments.
You can also request Amazon to increase the quota limits from here.

Hope that article was useful, See ya!!


 





4 comments:

  1. Anonymous12:14 AM

    Hey man thanks for this, it's very helpfully, thanks alote.

    ReplyDelete
  2. krishnaveni5:16 PM

    Notice: Undefined property: SimpleEmailServiceRequest::$resource in C:\wamp\www\TestApp\ses.php on line 491

    Warning: SimpleEmailService::verifyEmailAddress(): 60 SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in C:\wamp\www\TestApp\ses.php on line 357

    ReplyDelete
  3. krishnaveni5:59 PM

    Warning: SimpleEmailService::sendEmail(): Sender - MessageRejected: Email address is not verified. Request Id: 9747a9ff-0e1e-11e2-b3c6-dde140a94cea in C:\wamp\www\TestApp\ses.php on line 363

    ReplyDelete
  4. Thanks, it's very helpful for me.

    ReplyDelete