PHP Autoresponder script for peeps too cheapskate for Aweber
I’ve got a ton on mini-scripts that I’ve written for various side projects, or helper tasks, I thought that I’d start posting them here. This first script is an autoresponder email sequence script, that enables you to send a fan/subscriber friend a set of emails. Basically, its a cheapskate’s AWeber. Think of the possibilities:
- As an email marketer you can pound a person daily with offers related to a niche
- As a website owner you can remind people to tell their friends, colleagues, dogs about your site
- As an app owner you can remind them that the limited time offer is only valid for 5 days, 4, days, 3, days, 2 days, too late!
- As a person that is dying of some incurable disease you can send messages from when you are too weak to type and from beyond the grave
- The possibilities are endless…
.
>> download the php autoresponder script here
.
You’ll need hosting with..
- PHP
- A MYSQL database
- PHPMYADMIN or similar database management tool
- Cron
If you don’t know what any of the above are, then probably best to go to aweber instead.
How to set up
1) CREATE THE DATABASE TABLE: open sql.txt copy the create table code chunk and paste it into phpmyadmin or similar
2) CONFIGURE READY FOR DATABASE: open config.php enter your database user/pass/dbname/host & email from/email name settings here
3) ADD YOUR EMAIL SEQUENCE TIME GAPS:
add an extra $send_date[] row for each email in your sequence.
Time is calculated in MINUTES from sign up, so: 60=hour, 1440=day, 10080=week
The following sets up the time for 3 emails:
$send_date[] = 30; // 30 mins from adding email address
$send_date[] = 1491; // just over 24 hrs from adding email address
$send_date[] = 2910; // just over 48 hrs from adding email address
4) ADD YOUR EMAIL SEQUENCE
Edit config.php, it comes with 3 emails in the sequence. Edit the $title and $body for each.
Ensure that you have as many email $titles & $body as matching the number of $send_date[] s.
Don’t use ” quote marks in your email , as this will break the script, single quotes are okay.
If you want to add personalisation {name} {spare} and these will be replaced inline
HTML is okay in the email $body. E.g. use <br/> for line breaks
5) SETUP CRON
Setup cron to run file cron.php at ideally 1 min intervals if not possible, 1hr intervals should be fine. To run cron add a command similar to this command to run:
*/60 * * * * php -f /var/www/vhosts/yourdomain.com/httpdocs/emailsend/cron.php
ensure the patch to cron.php is correct and matches your server path, if you don’t know your server path run <? phpinfo(); ?> to see.
6) TEST SEND
Visit www.yoursite.com/emailsend/ and scroll down to fill in the test section with your email address/name
7) USE IT!
You can either add emaill addresses manually,
or alternately view the source of index.php and take the form out and use it in the frontend of a website.
You probably should password protect your /emailsequence/ directory too, to ensure no one snoops.
DISCLAIMER:
Obviously, I provide this script free to use and modify as you see fit. But don’t come crying to me if it doesn’t work as you expect.