Home > marketing, Scripts > PHP Autoresponder script for peeps too cheapskate for Aweber

PHP Autoresponder script for peeps too cheapskate for Aweber

March 18th, 2011

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


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


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


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.


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.

8) You probably should password protect your /emailsequence/ directory too, to ensure no one snoops.


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.

Post to Twitter Tweet This Post

marketing, Scripts

  1. June 18th, 2012 at 13:23 | #1

    How amazing are you? And, more importantly – WHY COULDN’T I HAVE FOUND THIS SIX WEEKS AGO?!?!?!?(LOL!). Seriously, I’ve combed the net using a variety of info-research techniques, and I found some pretty interesting examples (that just error to the point of distractive nightmare), but this is one of the more interesting scripts under this topic. Thank you for tossing this out to the wild like this. I think you’ll see some very interesting adaptations of this. I, for one am planning to try to cobble this together with some other “in-the-wild” code structures to achieve an original application. It’s not that any of the autoresponder outfits aren’t any good. It’s just that I want total control and autonomy when it comes to list building resources, and not someone piggybacking off my efforts (or having to pay for full access to services while enabling this). I heartily applaud you and am in the process of spreading the word on my side by indexing this post in some links from my site so more needy (ok, cheapo yank mugs, lol!) marketers get a peep on this. BTW, I’m still screamo cackling about the series of mails in the code. Just hysterical. You’re a real pant-wetter there, Ma’am…I gotta give it to you with that cheese motif…..

  2. June 26th, 2012 at 00:59 | #2

    What is the {spare} for or what does it mean? Got it all up and ready to go, but I need to know what this variable is first. Thanks – great script!

  3. paolo
    June 26th, 2012 at 09:12 | #3

    ho lee. glad you like it. thanks for your words!
    {spare} just means if you want to put some other personalisation thing in. as in its “spare”/free/available. When you add a person to the list, if you add something to the spare field, you can use it later in the templates.

    e.g. if you add a user with the spare field set to “cake eater”. you could pull {spare} into the email template, and thus replace {spare} with “cake eater”. and have a sentence like “I noticed you are a keen cake eater”..

  4. October 13th, 2012 at 14:28 | #4

    Paolo, thank you for your reply. I’ve been so busy lately (burial of parent, etc.), that I totally forgot about waiting for your answer. I was re-drawn to this post when I read something in one of my forums, and wanted to make a positive point. Sorry if you suddenly get an influx of emails enquiring after this amazing resource. I’ve configured it and using it as an autoresponder for spammers who just don’t know how to market (lol!). Thanks again, Paolo, and, GREAT work!

  5. January 5th, 2013 at 22:00 | #5

    This is a great post and a great script. I wonder why there are only a few comments… If someone knows a little bit of PHP they can use this script as a base and expand it. But it is great and working perfectly on my side. I have a question though… What about those e-mail addresses in the DB that have received all the e-mails? Is there a way to delete them after the entire sequence of e-mails have been sent? Thnx so much for this script. I searched a lot for something like this!

  6. January 7th, 2013 at 21:59 | #6

    HEY PAOLO!!!!!!!!!!!!!!!LOLOLOLOL!!!!

    Managed to put a whoopass wrangle on yer code to make it a treat bunch better as an AUTORESPONDER with an admin panel – check over here at;
    http://raiderstpz.com/tester/index.php. The whole autoresponder is being called through index.php, all the while residing in another folder which itself protected by a login process. Haven’t tested it yet, but, THEORETICALLY, there’s no reason why it shouldn’t work. Thanks again, yo.

  7. January 9th, 2013 at 06:37 | #7

    I’m BAAAAAAAAAAAAAAAAAAACCCKKK!!!!! After a grueling 27-hour makeover, the script is now a comfortable AUTORESPONDER application – as in, Ive managed to completely hide the list of emails that go out behind a login window, which returns them to view upon authentication. Had a crab of a time trying to twist it to my exact specifications, but I’m now super-tired, happy, and wanting to let you know that someone’s out there trying to expand their boundaries of coding knowledge. Thank you SO much, Paolo. But now my head hurts (lol!)……………

  1. No trackbacks yet.