How-To Install Sendy On Nginx With Amazon SES

Spread the love

Sendy.co is a self hosted email marketing tool that hooks in seamlessly with Amazon SES for an incredibly cheap way to send out emails to your customers or newsletter list.

This article will go over how to install your Sendy license on an Nginx web server and integrate it with Amazon SES. This article assumes you already have a LEMP web server setup. If you do not, you may be interested in my article on setting up a Centmin Mod LEMP server.

Download & Install Sendy

After you purchase Sendy from their website you will receive your email confirmation with your download link. Simply download the files to your computer, extract the archive and then upload your files to your domain. You can choose to use the root of the domain or create a folder to put your sendy files in. Since I am going to use the domain for something other than sendy, I am going to create a folder called “sendy” and put my files there. This means that you would access sendy with mydomain.com/sendy/.

At this point you should have created a database for your sendy installation so lets edit Sendy and provide them with the database information so Sendy can run its installation scripts.

The configuration file is located at includes/config.php. The only settings we need to change in config.php are the following:

 /* Set the URL to your Sendy installation (without the trailing slash) */
define('APP_PATH', '');

/* MySQL database connection credentials (please place values between the apostrophes) */
$dbHost = ''; //MySQL Hostname
$dbUser = ''; //MySQL Username
$dbPass = ''; //MySQL Password
$dbName = ''; //MySQL Database Name

These are pretty straight forward. Simply provide the path to your Sendy installation. For example, if you used my example and placed sendy in a subfolder called sendy and you are using https (which you should be!), your path would be:

define('APP_PATH', 'https://www.yourdomain.com/sendy');

Make sure to note that you should not have a trailing slash after sendy. Here is a gif as an example:

The other remaining four settings you need to fill in are all related to your database credentials. Once you have everything filled in, save your file and upload it to your server.

Before we install we need to do two things: edit our nginx virtual host file so that all urls in Sendy will work correctly and make sure our Amazon AWS account is ready to use.

Edit Your Nginx Virtual Host

Your nginx virtual host file for your domain will vary in location depending on how you installed nginx. If you have installed nginx using Centmin Mod, like I have, your virtual host files will be located at:

/usr/local/nginx/conf/conf.d/

Once you have located your virtual host file for your domain, you will need to edit it and add the following location rules. Please pay attention to the location where you installed sendy. These rules are assuming that you have installed sendy in a folder called sendy in the root of the domain.

    location /sendy/l/ {
        rewrite ^/sendy/l/([a-zA-Z0-9/]+)$ /sendy/l.php?i=$1 last;
    }

    location /sendy/t/ {
        rewrite ^/sendy/t/([a-zA-Z0-9/]+)$ /sendy/t.php?i=$1 last;
    }

    location /sendy/w/ {
        rewrite ^/sendy/w/([a-zA-Z0-9/]+)$ /sendy/w.php?i=$1 last;
    }

    location /sendy/unsubscribe/ {
        rewrite ^/sendy/unsubscribe/(.*)$ /sendy/unsubscribe.php?i=$1 last;
    }

    location /sendy/subscribe/ {
        rewrite ^/sendy/subscribe/(.*)$ /sendy/subscribe.php?i=$1 last;
    }

Once the rules have been added, don’t forget to restart nginx so that they are loaded.

Configure Amazon SES

Log in to your Amazon AWS account and head over to Amazon SES.

Verify Your Domain, DKIM, SPF & MAIL FROM Domain

You should be presented with a big blue button to verify your domain. Enter your domain name and click Generate DKIM Settings.

Click the button to get started.

Click Verify This Domain and you will be taken to another page that will list DNS entries that will need to be made in order to verify your domain is yours and to enable DKIM verification.

Follow the instructions to add Domain Verification Record and DKIM Record Set to your DNS. You do not need to worry about Email Receiving Record.

Once you are done adding, close the pop up and then click on your domain name. You will see at the bottom MAIL FROM Domain. Click this and then click the Set MAIL FROM Domain button.

You will get a pop up that will ask you for a subdomain to use. I always use mailer.yourdomain.com. You can use what you would like but remember it needs to be unique so it can’t already be in use.

You will also want to check Use amazonses.com as MAIL FROM as well. Here is an example of mine:

Click the blue button when you are done and now you will have an MX and SPF record you will need to add to your DNS. Follow the instructions and the close out the pop up.

You should now have all your DNS entries setup for your domain and all your emails should have no trouble passing all the spam checks. Here is the end result for Cloudflare DNS users:

Enable Amazon SNS For Bounce & Marked Spam Handling

Sendy includes support for handling any bounced emails from your list and it also supports removing people from your list that mark your emails as spam. Both go a long way to helping you keep your emails from showing up in the spam folder of your customers or subscribers.

Start by visiting your Amazon IAM console, then follow the instructions in the video below:

Once you’ve created your IAM credentials, copy and paste them into the installation page. Sendy will now have access to send your emails via Amazon SES as well as setup bounces and complaints handling with Amazon SNS.

Finally, if this is your first time using Amazon SES, you’ll need to request Amazon to increase your SES Sending Limits to get your Amazon SES account out of “sandbox mode”. You’ll then be able to send to and from any email address as well as raise your daily sending limits from 200 per day to any number you need.

Finish Installation

At this point all that is left is to finish your installation. Go to the place where you have installed Sendy and it should redirect you to installation page. Fill in the information asked, noting that in the previous step you created the Amazon IAM credentials asked for at the bottom. Once filled out, simply submit and now you are on your way to setting up your first Brand and sending out your first emails! For further help see https://sendy.co/troubleshooting and https://sendy.co/forum/.


Spread the love

Leave a Reply

avatar
  Subscribe  
Notify of