Email Marketing on a Shared Host

phplistDo you need to send newsletters to your customers? Or do you have a new product that you want to offer to your subscribers? If so, your best bet is to use aweber…

However, if you would rather save your money, or if you just rather do things on your own, then read on… I will show you how to use a free software called PHP List to run email campaigns (and save you the headache that most go through when trying to set this up properly).

Shared Hosting Issues

Shared Hosting… we hate it, right? They say it’s unlimited bandwidth, but then one day they suspend your account because your site got a lot of traffic and apparantly you used too much memory and “such and such nodes of a cluster”, etc. blah blah blah… lol. what? uh ok.

Anyway, along with the ‘unlimited’ bandwidth (sarcasm), you also are limited to the amount of emails that you can send per hour (and per day). I use Lunarpages and my hourly limit is 400 emails (and 8000 per day). So if you have an email list of 420, you certainly cannot bcc them all in outlook. well, you can, but your email accounts for your domain will be suspended. So lets avoid that and just install PHPLIst.

PHP List

If your shared host has cPanel, then log on and navigate to fantastico (and now softaculous). Install phplist on the domain that you want to send emails from. If you do not have cPanel, then that sux… lol joking, kinda… you will have to visit their site and download and install it manually: PHP List.

Setting the Send Speed

Since most shared hosting providers have a limit on the amount of emails that you can send per hour, we have to configure PHPList to not allow more than the max amount to be processed. There are two methods to doing this. The first is using the throttle, and the second is by using batch processing. Both are set from within the config file. So download the config.php file (via ftp) and open it up in your favorite editor (mine is dreamweaver).

METHOD 1 – Using Throttle
You can use throttle to ensure that you stay below 400 emails per hour. Throttle basically creates pauses after each email is sent. So if you set your throttle to 15 (which would create a 15 second pause after each email sent), then you would only send 240 emails per hour. One hour equals 3600 seconds; 3600 seconds divided by 15 seconds equals 240 emails per hour. Look at the config file and set your values like so:

# batch processing disabled:
define(“MAILQUEUE_BATCH_SIZE”,0);

# Batch_period is not effective when batch processing is disabled:
define(“MAILQUEUE_BATCH_PERIOD”,3600);

# Pause between messages (in seconds) to send no more than 240 messages per hour:
define(‘MAILQUEUE_THROTTLE’,15);

METHOD 2 – Using Batch Processing
Instead of using the throttle method, you can use another method called batch processing. Basically you set the amount of emails that you want to send per batch (Batch Size); then you set the batch period. So if your batch period is set to 3600 seconds (one hour), and your batch size is set to 360, you will send a maximum of 360 emails every hour. You can still set the throttle to 1 second just to be safe and not overload the server. This will pause for one second after each email sent (as oppossed to sending 360 emails all at once). If you would like to do this method, set your config values like below:

# Send a batch of 360 messages per batch period:
define(“MAILQUEUE_BATCH_SIZE”,360);

# batch period is set to 3600 seconds (=1 hour):
define(“MAILQUEUE_BATCH_PERIOD”,3600);

# Pause between messages (in seconds) to avoid overloading the server:
define(‘MAILQUEUE_THROTTLE’,1);

Cron Jobs

Regardless which method you choose above (Throttle or Batch Processing), you will need to create a cron job to process the queue. Why? Well you could just log into phplist and after creating your message, just click the “process queue” button… HOWEVER, Then you are using a web browser to process & send your emails. This would be bad for a few reasons… One, your browser session will likely time out before all of your emails have been sent. Two, PHPList will log you out due to inactivity before all of your emails have been sent. In both cases, since you are using the web browser to send your emails, the process would be interupted and ended.

That’s why you need to create a cron job. What is a cron job? It’s a process that executes commands at specified times. Hmm, what command (you ask)? Well, the command that will go into phplist and process the queue. This will process the email list on the server instead of the browser. Now you don’t need to worry about the browser timing out and ending your email process. But wait, your server can also time out (some time out after 20 minutes)… So, you can set your cron job to run every 15 minutes (so that if it times out, it will restart in 15 minutes anyway, and continue processing the emails where it left off.

Set Up a Cron Job

First you need to comment out the following line in phplist config file:

# $commandline_users = array(“admin”);

Then uncomment this line:

$commandline_users = array();

Cron JobIf you are using cpanel, then it can’t get any easier. Just login to your cPanel and select cron jobs. Select 15 minutes (like in the attached image), and enter the following on the command line:

/usr/local/bin/php/home/***CPANELUSERNAME***/
public_html/***DOMAIN***/phplist/admin/index.php -p processqueue

The above must be all on one line. Also, make sure you fill in your cpanel user name and domain.
FYI: I delete my crons after the emails have all been sent.

Using PHPList

Well, This post is sooo long already, so I’m not going to go into detail about how to use phplist. I will do a very quick bullet list just to get you in the right direction.

  • Add your email list to phplist. Make sure your email is in the list also (so you can send a test email to yourself)
  • Set all users to receive html emails: manage users | reconcile users | mark all users to recv html
  • Create a blank template. just paste “[content]” into the template (minus the quotations)
  • Create the message
  • Send yourself a test to make sure it looks good
  • Select the list to send it to, then click “send message to the selected mailing lists”

FYI: DO NOT process the queue. The cron job will process the queue for you.
That’s it, Hope this has helped.

2 Responses to “Email Marketing on a Shared Host”

Read below or add a comment...

  1. Shantel says:

    too advanced for me :-)

Leave A Comment...

*