I was recently looking for a very simple PHP mailing list script. I essentially wanted the ability to notifiy friends and family when I’ve updated a website with new pictures. I, of course, wanted unsubscribe capability, email confirmation and other simple features. I spent WAY too much time downloading and trying out free scripts on the web. However, none of them accomplished the simple tasks that I wanted, if they even parsed correctly by PHP.
So, I decided not to waste any more of my time and just created one of my own. I wanted to keep it simple, so all the data is stored in a flat file. No database necessary. This is either a flaw or a feature, depending on your perspective.
My resulting script turned out very well. I used phpMailer to handle the mail transport. This also lets me completely customize how I want to send messages. Many scripts I saw rely on the ability to execute /sbin/sendmail. However, on many hosting providers, this is not available. So, I use phpMailer to authenticate through my email provider’s SMTP host. I can even change the port number.
The other thing I wanted was a simple, clean integration with my site. I didn’t want to fool with inline frames or creating another css file for the mailer. So, with my script, you can put the form wherever you like on your site. As one of the fields, set the hidden ‘callback’ flag. This will cause the script to return to the calling page with a result message (like: ‘firstname.lastname@example.org has been subscribed.’) Then, you do whatever you want with it.
The script also has a default, no frills form that you can use or copy it into your page and modify it.
Once you are ready to send a message, just point your browser to the send message script, and type your message. You then preview the message and hit send. It gets sent as one message, adding all of the addresses as ‘bcc:.’
So, just to summarize the features:
- Ability to completely configure your smtp server. This includes authentification and port settings.
- Callback functionality provides a clean integration to your site
- Subscribers can easily unsubscribe
- No database needed
- Easy to send messages
- Licensed under LGPL, free for the taking
The downside is that you’re on your own for security here. However, you can easily come up with an htaccess file to password protect the email list and composer script. I’ve provided samples on how to do this with the package.
I’m open to suggestions, just leave a comment on this post. I hope you find it useful, if you do, feel free to donate a couple bucks if you want.