Ringing The Church Bells Via SMS

We’re putting together a text-messaging reminder service for our meetings. Every Wednesday night at 7pm our website will send out a SMS message to the cell phones of everyone who signs up reminding them to get ready for Chi Alpha’s weekly worship meeting. It’s a simple message to help out those students who always mean to come but get busy doing something else and forget until the meeting is partway over:

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

I’ve just tested the system and it works pretty smoothly. It’s the modern-day equivalent of ringing the church bells!

The script was really simple to write. If you use a unix-based system with PHP & PEAR installed you could easily adapt it for your ministry:

#!/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 customize the script (add cell phone numbers 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 without saying that you never add someone to an SMS announcement system without their express permission! If you think email spam hacks people off, then just wait until someone has to pay a text-messaging fee for something they’re not interested in. The depths of their rage would astonish the Hulk.

Geekspeak: the reason I used the PEAR::Mail library was to make sure that the reply-to address was the one I wanted. I just couldn’t make it happen using the PHP mail() function alone. Everything was from “root@my webserver.” Very annoying.

0 thoughts on “Ringing The Church Bells Via SMS”

Leave a Reply