|AWS Low Cost Mailing List Using phpList And SES|
|Written by Ian Elliot|
|Tuesday, 27 September 2022|
Page 2 of 2
The next and almost final major step is to install phpList. This is easy to do as long as you can transfer files from your local machine to the new server. I usually set up WinSCP or something similar and make an SCP connection to the server. If you are using WinSCP then select SCP as the protocol, use the AWS keyfile ppk as your authentication and select sudo su - as your shell as this gives you root access, which you will most likely need.
To install phpList go to:
and download the ZIP file (or the TGZ file) unzip the file and copy the lists directory into the webserver's HTML directory, usually
The lists directory contains all of the PHP files you need to make it work. The PHP program creates the database tables you need, but you have to create the database, i.e. a schema, and a user. To do this in MySQL Workbench simply select the Create Schema icon or in a MySQL console enter:
CREATE SCHEMA myMailer
or whatever you want to call the database.
Next you need to setup a user for the phpLists program to use to connect to the database. This is often difficult to do using MySQL Workbench because of the different security mechanisms. The simplest thing to do is use a command line:
CREATE USER 'myMailerUser'@'localhost'
where you replace password by a strong password and use a different user name if you want. This assumes that you will be connecting via SSH and are going to be treated as a local user. Finally, you need to grant admin rights to the new user:
GRANT ALL PRIVILEGES ON *.* TO 'myMailerUser'@'%';
This is probably too much privilege, but you can worry about reducing it after getting things working. At the moment the program needs to be able to create tables.
With the database and user created we now need to tell phpLists about them. Edit the config file you will find in the config directory to read:
// what is your Mysql database server hostname
// what is the name of the database we are using
// what user has access to this database
// and what is the password to login to control the database
Save the config file and leave other entries as they are. There are lots of configuration options you can adjust later.
As long as all of the details are correct you should now be able to start phpList and use it to create the tables you need. Go to:
This will create the tables you need and let you set up an admin user with the default user name admin and you supply the password to be used in future.
You can start to explore phpList and discover how to setup emails and lists to send emails from. There are also features to setup web pages to get people to sign up and manage their accounts. What you need to do here depends very much on what you want to hand over to the mailing list. I decided to keep the website's existing sign up pages and migrate slowly to using phpList to manage users. You can easily import an existing user database using CSV. It is easy to export from the database in CSV format and very easy to import it.
Getting the server up and running is only part of the story. We now need some way of sending emails. You can setup any SMTP server you have access to but a good solution for many users is Amazon's SES service. This lets you send build emails and as you are using an AWS server the good news is:
$0 for the first 62,000 emails you send each month, and $0.10 for every 1,000 emails you send after that.
You also have to pay for data transfer, but you can ignore this unless you are sending big attachments where you pay $0.12 per gigabyte (GB) of data. What this means is that if you are sending fewer than 62,000 emails per month your only significant cost is the server.
To set up phpList to send via SES the simplest solution is to install the SES plugin. Sign in to phpList, navigate to the Config menu and select Manage Plugins. Use Find Plugins to find the SES plugin. Use the installation URL, currently:
to install the plugin. You also need to enable it and the CommonPlugin which it makes use of. You then need to configure the SES plugin. Use the Config, Settings menu and scroll to the section that concerns the plugin. You need to enter an AWS access key ID and the secret access key and you have to first create these using the AWS IAM service. Create an Access key specifically for phpList and use them in the phpList config. You also need to specify the SES region and the endpoint in use and these you can look up in your SES account.
With all of these pieces of information in place you still might not be able to send an email. To test this, start a new campaign and send a test message. If it isn't sent check the log and you will probably see that SES is rejecting the email due to the sender's email address not being validated. Either change the phpList configuration so that it is sending from an SES validated email or use the SES console to validate the email address you are using. Once this is achieved you will find that you can send a test email and a mailing list once you have one set up.
You can now spend time tuning and customizing your phpList setup. Make sure that you set the sending rate to fit in with your SES maximum rate. If you are not using the server to manage the mailing list you could opt to switch the machine off when it is not sending. This would reduce the hosting bill, but this is only worth doing if you don't allocate an Elastic IP EIP address to the machine. An EIP keeps your server at a fixed address and this makes life easier. It is also free, but only while the machine is running. When it is suspended the EIP not in use is charged at $0.005 USD per hour, which is $3.60 per month, which is not much less than the cost of keeping the server live 24/7 and it is actually more if you use an ARM t4g.nano. The economics of AWS are a complex mystery.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Tuesday, 27 September 2022 )|