Home » Technology » Apple & Macs » ISP-In-A-Box: The $500 Mac mini (Chapter XII, Email Reminders)

The Most Versatile VoIP Provider: FREE PORTING

ISP-In-A-Box: The $500 Mac mini (Chapter XII, Email Reminders)

One of the most useful additions to any server is the ability to send yourself or others Email Reminders. Adding a web interface is simply icing on the cake. Yes, PDAs and cell phones and iCal can do it as stand-alone applications, but you have to be with the device where you scheduled the reminder, or you miss it. With a web-based email reminder system, you can send reminders to multiple devices and multiple people, not just yourself… and you can schedule them up to nine years in advance (assuming your server makes it that long). If you have teenagers, I don’t have to tell you how much they will appreciate your computer sending their cellphones reminders to clean their rooms in the middle of their night on the town. It also comes in handy to make sure you pay bills on time. And, you’ll find it absolutely essential in getting out of boring meetings early by simply sending your cellphone an urgent message at the top of the hour. Yes, the reminders can be recurring: every hour, every day, every month, or every year. And no, email reminders won’t cost you a dime. Unfortunately, it’s another of those little Linux gems that just didn’t quite fit the Mac way of doing things. So, we’ve fixed it up, added the missing pieces for MySQL and Perl, and repackaged it for all the Mac addicts who have built one of our ISP-In-A-Box systems these past few weeks.

Prerequisites. Before Email Reminders will work on your Mac, you’ll need to assure that you’ve enabled the Apache Web Server, the Postfix SMTP email server (POP and IMAP are not required!), the MySQL database server, PHP, and PhpMyAdmin. You’ll also need Webmin to add the crontab scheduling piece unless you’re familiar with using crontab directly … which we’re going to cover later this week, incidentally. For Email Reminders to function properly after installation, you’ll need to keep the following servers running all the time: Apache, Postfix SMTP, and MySQL. Aren’t you glad you bought that extra RAM!

Our approach should be getting familiar by now. We’ll download the software to your desktop, then move it to its permanent home on your web server. Next, we’ll run a simple MySQL script to create the necessary database to manage your reminders. Then we’ll customize the software to add your email return address. And finally, we’ll set up a crontab script to check for reminders to be sent at the top of every hour.

Downloading Email Reminders. You can learn all about Email Reminders at the author’s web site, but unfortunately for Mac users, the version available there just doesn’t quite work as packaged with Mac OS X. So we’ve customized the software a bit to match our ISP-In-A-Box configuration, and it’s available for download here. Once the 100K download to your Desktop completes, it should decompress into a folder named emrem. If not, double-click on the downloaded file to start the process.

Moving Email Reminders to Your Web Site. Open a Finder window, click on your local hard disk, and navigate to the /Library/WebServer/Documents folder. Then click-and-drag the emrem folder on your Desktop into the Documents folder. This will make your Email Reminders application available with a web browser using the syntax: http://yourdomain.com/emrem/ or http://localhost/emrem/ from your server desktop.

Building the Email Reminders MySQL Database. Open a Terminal window and switch to root user access: sudo su. Now move to the folder where we installed emrem:

  • cd /Library/WebServer/Documents/emrem
  • After making certain that MySQL is running (/library/startupitems/mysql/mysql restart), type the following command to create your Email Reminder database:

  • /usr/local/mysql/bin/mysql < emrem.sql
  • Customizing Email Reminders. While you’re still positioned in the emrem folder, let’s add your own email return address just so email reminders don’t get bounced as spam. We’ll edit the configuration file with out usual Pico editor and, yes, BE CAREFUL: pico config.php. Now search for yourname: CTRL-W, yourname, then enter. Carefully delete yourname@yourdomain.com using the CTRL-D key. Now type your email address in its place. Save your changes: CTRL-X, Y, then enter.

    Verifying All Is Well. Let’s run a simple test to be sure everything worked according to plan thus far. After assuring that your web server is running, switch to a web browser and go to http://localhost/emrem/. Now add an entry to send an Email Reminder to your own email address and schedule it for the next hour. Once you get a completed message, let’s use PhpMyAdmin to verify that the reminder was actually placed in the MySQL database we set up. Start PhpMyAdmin: http://localhost/php/. Click on the Databases pull-down and choose the emrem database. Now click on the reminders table, and choose the Browse tab. You should see one entry in your table. You can close your browser window now, but keep in mind that this is where you’d come to delete a reminder if, for some reason, something ever goes haywire. I’ve never seen it happen in four years of use!

    Scheduling the Email Reminders Task. Finally, we need to schedule the Email Reminders Perl script to run each hour. It is responsible for checking to see if reminders are due to be sent and sending them. Start up Webmin if it is not already running on your server: /etc/webmin/start. Now open Webmin with your browser: http://localhost:10000. Enter admin for your username and your actual password. Click on the System button and then Scheduled Cron Jobs. Then click Create a new scheduled cron job. Make the following entries in the form and then click the Create button. Leave the default settings unless specified below:

  • Execute cron job asroot
  • Command/Library/WebServer/Documents/emrem/cron-emrem.pl
  • When to executeTimes and dates shown below
  • Minuteclick on Selected and click on the number 1
  • Hours, Days, Months, WeekdaysAll
  • Now all you have to do is wait for the top of the hour, and your first Email Reminder should arrive within a minute or two. Before redistributing this software, please read the license terms in the COPYING file which can be found in the emrem folder on your web site. Enjoy!


    1. I can not figure out what I did wrong but here is the message I get in mail when I try to send a reminder: From root@kathy.local Tue Feb 22 17:01:03 2005
      X-Original-To: root@kathy.local
      Delivered-To: homersta@kathy.local
      Received: by kathy.local (Postfix, from userid 0)
      id B761F2376E5; Tue, 22 Feb 2005 17:01:01 -0700 (MST)
      From: root@kathy.local (Cron Daemon)
      To: root@kathy.local
      Subject: Cron
      X-Cron-Env: X-Cron-Env:
      Message-Id: <20050223000101.B761F2376E5@kathy.local>
      Date: Tue, 22 Feb 2005 17:01:01 -0700 (MST)

      /bin/sh: line 1: Library/WebServer/Documents/emrem/cron-emrem.pl: No such file or directory

      [WM: Looks like you’re missing the forward slash in front of Library for the command line to run cron-emrem.pl.]

    2. emrem will not run. When I run the cron job to test emrem I get the following error:

      Can’t locate Date/Calc.pm in @INC (@INC contains: /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .) at /Library/WebServer/Documents/emrem/cron-emrem.pl line 21.
      BEGIN failed–compilation aborted at /Library/WebServer/Documents/emrem/cron-emrem.pl line 21.

      Everything else is running fine. Can you help?

      [WM: Just Google for "can’t find date/calc.pm" and you’ll find your answer.]

    3. In case you don’t remember, I am the individual who installed all of these modules via Fink. I actually got the system (inc emrem) to work with php5 (instead of php4) without any problems. But, when I did the latest Fink update of mysql (without really checking to see what I was installing, the email reminder functionality stopped working. Specifically, I would type in localhost/emrem, and it would spin in the background, and then stop spinning, leaving a blank page. I ran the script in webmin, and the script seems to run fine. So, I believe that it is some problem in the GUI. Any thoughts as to how to fix this?

    4. I got email reminders to work with PHP5. It would not display the first screen, just a blank page. I just put ‘php’ after ‘

    Comments are closed.