Ringing The Church Bells Via SMS

We’re putting togeth­er a text-mes­sag­ing reminder ser­vice for our meet­ings. Every Wednes­day night at 7pm our web­site will send out a SMS mes­sage to the cell phones of every­one who signs up remind­ing them to get ready for Chi Alpha’s week­ly wor­ship meet­ing. It’s a sim­ple mes­sage to help out those stu­dents who always mean to come but get busy doing some­thing else and for­get until the meet­ing is part­way over:

Chi Alpha at 8:00 tonight in 300–300.

I’ve just test­ed the sys­tem and it works pret­ty smooth­ly. It’s the mod­ern-day equiv­a­lent of ring­ing the church bells!

The script was real­ly sim­ple to write. If you use a unix-based sys­tem with PHP & PEAR installed you could eas­i­ly adapt it for your min­istry:

#!/usr/bin/php
 ?php
//sends SMS announcments to each person in Chi Alpha who wants them

require_once('Mail.php');
$parameters['sendmail_args']='';
$mailer=&Mail::factory('sendmail',$parameters);

$cells['Ferdinand Frosh']='5555555555';
$cells['Suzie Sophomore']='5555555555';
$cells['Jing Junior']='5555555555';
$cells['Sheila Senior']='5555555555';

$headers['From']='you@example.com';
$headers['Reply-To']='you@example.com';
$headers['Subject']='XA @ 8pm';
$body='Chi Alpha at 8:00 tonight in 300-300';

foreach ($cells as $cell) {
        if (empty($cell)) continue;
        $email=$cell.'@teleflip.com';
        //echo $email;
        $mailer->send($email,$headers,$body);
}
?>

All you have to do is cus­tomize the script (add cell phone num­bers and the right “From” and “Reply-To” emails) and then add it to your crontab file with an entry like so:

0 19 * * 4 /path/to/announce.php

(Hint: type crontab ‑e to edit your crontab file).

By the way, it should go with­out say­ing that you nev­er add some­one to an SMS announce­ment sys­tem with­out their express per­mis­sion! If you think email spam hacks peo­ple off, then just wait until some­one has to pay a text-mes­sag­ing fee for some­thing they’re not inter­est­ed in. The depths of their rage would aston­ish the Hulk.

Geek­s­peak: the rea­son I used the PEAR::Mail library was to make sure that the reply-to address was the one I want­ed. I just could­n’t make it hap­pen using the PHP mail() func­tion alone. Every­thing was from “root@my web­serv­er.” Very annoy­ing.

0 thoughts on “Ringing The Church Bells Via SMS”

Leave a Reply