Synopsis
In the previous blog post I elaborated on SES (Simple Email Service). Simple Email Service is a fully managed service which allows you to send emails for transactions, marketing, system generated mails, newsletters and much more. It is a service, which can be utilized to send emails. It also provides notifications for bounces, complaints and rejected emails.
Other areas of focus in the blog included:
- Why to use AWS SES?
- Why NOT Amazon SES?
- What are the different ways to send Emails via AWS SES?
- Is AWS SES too Expensive for Me?
Furthermore I will be articulating more about SES.
Heterogeneous Ways to Send Mails from SES
Using SMTP
There are different ways you can use SMTP Credentials for sending emails. It includes:
1. Sending from AWS console
- Login to aws console go to SES Service
- Click on “Email Address” Or “Domain” tab in left Frame
- Select Email or Domain and click on “Send Test Mail”
- Fill in the Details and send Email.
2. Sending from command line: People writing programs Directly through SMTP can also send Emails by configuring SMTP with SES. For more info follow the instructions on AWS Doc
3. Send Emails from Email Client- e.g. Microsoft Outlook 2010: To configure Microsoft Outlook 2010 in your System follow the instructions given.
4. Send Emails from your Application: You can use SES in a way similar to using Gmail or Hotmail Credentials for sending emails from your application in a way that you don’t share your email Address Credentials in the application. Listed below are the steps to configure SES in an application built in YII Framework:
- Download PHPMailer extension for YII Framework from here and configure it in YII.
- Create a class SendMail in Model and Extend PHPMailer Class and Declare Following Variables:
class SendMail extends PHPMailer{
var $Host = “tls://email-smtp.us-east-1.amazonaws.com”; //Amazon Server based on Region
var $Username = “xxxxxxxxxxxxxxxxxx”; //Enter Access Key from Amazon
var $Password = “xxxxxxxxxxxxxxxxxxx”; //Enter Secret Key from Amazon
var $Port = 465; //You can use 25, 465 and 587 port to send email
var $SMTPAuth = true;
var $From = “example@example.com”; //From may be any email you want
var $FromName = “Any Name”;
var $CharSet = “UTF-8”;
var $Sender = ‘example@example.com’; //Sender has to be verified email !!!
var $SMTPDebug = false; // set true if you want to debug
var $SMTPKeepAlive = true;
}
- Add a Function sendEmail to accept Parameter for
- Whom to send
- What to send
- What subject
function sendEmail($emailTo,$subject,$body){
$this->AddAddress($emailTo);
$this->Subject = ($subject);
$this->Body=$body;
return $this->Send();
}
- Now Import this class and call sendEmail Function and send email.
include_once(‘SendMail.php’);
$sendMail=new SendMail();
$sendMail->sendEmail(“reciver@example.com”,’T est Email’,’Hello world!’);
5. Integrating SES with other SMTP server: You can also configure your SMTP server to use SES and send Valid and Non-Spam Emails. Listed are the following SMTP Servers you can configure on-
- Postfix
- SendMail
The next series of blog on SES(Simple E-Mail Service) I will be discussing more on using AWS API’s to send E-Mails.
Related Blog Posts:
Facts you Must know about AWS Cloud’s Simple Mailing Service