Amazon SES with phplist

Hi Everyone .This is my  first post ,in this post i’m going to share my experience on sending mail through phplist using Amazon SES. I’m proceeding to the steps by assuming that you have basic idea in phplist and Amazon SES.


Amazon SES(Simple E-mail Service) is very reliable and scalable, it also  very cost effective email sending service. phplist  is the world’s most popular opensource email campaign manager . lets discuss the steps for configuring Amazon SES in phplist for sending Mail.

There are mainly two ways to configure phplist to send mail through Amazon SES.

  • Using Amazon SMTP credentials
  • Using Amazon Access Keys

Using Amazon SMTP credentials


To create SMTP credentials read the document described in Amazon web service.to read click here . after obtaining your credentials edit the config.php in phplist. Add following lines in config/config.php ,

 $message_envelope = 'bounces@testing.ie';
 $bounce_protocol = 'pop';
 $bounce_mailbox_host = 'mail.testing.ie';  (your bounce emai l + settings from mail provider)
 $bounce_mailbox_user = 'bounces@testing.ie';
 $bounce_mailbox_password = 'password';

and also add these SMTP setting lines too in config.php,

define("PHPMAILERHOST",'email-smtp.us-east-1.amazonaws.com');
$phpmailer_smtpuser = 'Your user id';   (not the ses.user name that appears 1st, the numerical one)
$phpmailer_smtppassword = 'Password';

define('PHPMAILERPORT',465);
define("PHPMAILER_SECURE",'ssl');
define('SMTP_TIMEOUT',45);

Replace above settings with your SES SMTP settings. Now its ready to send Mail from phplist ! Check your SES dashboard or the mail to verify its send through the SES. We can connect to the SES SMTP host using ,SSL OR TSL ON ports 587,25,465. Try these all ports if anyone fails.its also good to check with the openssl to send mail from ses smtp interface, so that you can conform you can connect to the smtp host. The steps are clearly described in official documentation.

after sending mail from phplist If you get any errors in log of events like below,

  • Amazon SES status 0 connection timed out() !
  •  and SMTP Connect () failed !

its mainly occurs if the outbound connection to the port 587,25 is blocked .some  hosting provider block the outbound connection to the respective ports ,So conform the ports are open before going to use for avoiding such errors. its not a issue if you have a dedicated host. it mainly occurs in shared host .

NOTE : To send Bulk mail from phplist you must moved from SES SANDBOX . if you are in sandbox then you have some restrictions that you cant send mail to not verified email address and there is a message limit ,200 per day. To move out from sandbox read the official documentation here.

Using Amazon Access Keys


You can also connect ses smtp using aws access keys.in this case you dont nedd to specify the smtp host .before configuring phplist create a user in AWS as follows, goto aws iam user console.

P1

create a user like above,  a new windows open,

P2

enter the user names as above,after that create the user you get aws secret key & access key ID ,download the credentials and keep it safe. then attach a user policy with the created user for accessing the SES SMTP.

P3

When click attavh policy you can see a list of permissions check the AmazonSESFullaccess , save it. Now its time to configure the phplist,

Add following lines in config/config.php

define("PHPMAILER",0);
define("PHPMAILERHOST",''); 
define('USE_AMAZONSES',1);
define('AWS_ACCESSKEYID','YOURACCESSKEY');
define('AWS_SECRETKEY','YOUTsecretKEY');

Configure the setting above by using previously downloaded credentials. And also  ,Change following line in admin/init.php

//if (!defined('PHPMAILERTESTHOST') && defined('PHPMAILERHOST')) {
if (!defined('PHPMAILERTESTHOST') && PHPMAILERHOST!='') {
  define('PHPMAILERTESTHOST',PHPMAILERHOST);
}

Note: When commenting the  line above ensure the PHPMAILERHOST is blank.

now you can send mail through the phplist using aws ses. if you get any errors like below  in logs of event in phplist,

Amazon SES status 400 …E-mail address is not verified

then you need to verify from email address in AWS SES . for list of SES SMTP Status click here.

thats all ..if you face any errors by using above steps , feel free to comment below.

Advertisements

8 thoughts on “Amazon SES with phplist

  1. Mike says:

    So it’s been a few weeks since you posted this. How has your experience been using PHPlist with Amazon SES? Has everything been going smoothly since the set up?

    Like

  2. Syed Asad Ahmed says:

    hi,

    I am configuring phplist on amazon EC2 and trying to send email using amazon SES.

    My problem is when I send email I gets error

    “SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting |”

    As per the sugestion in the article I have opened port in the securtity group outbound rule i am still getting the same error.

    Furthermore when I telnet the port 25 from my local machine (laptop) it says “could not open connection to the server”.

    Please help me how can i resolve this issue? If you need any more info about my configuration I will be very happy to let you know.

    Thanks waiting for the reply.

    Like

  3. JohnB says:

    I am funny about not liking to change OSS code if I can avoid it.

    By adding the following line to config/config.php

         define("PHPMAILERTESTHOST",''); 

    You can avoid having to change (and maintain across phpList updates) admin/init.php

    Like

  4. matthewckaz says:

    Thank you very much for this! What are you using for your MAILQUEUE_BATCH_SIZE , MAILQUEUE_BATCH_PERIOD, and MAILQUEUE_THROTTLE settings? My problem using my hosting service was that it would always time out and I kept trying to adjust these, and nothing work… thus, my move to Amazon SES. But maybe these don’t matter using Amazon?

    Thanks a bunch!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s