In a previous post, I noted Ashwin Matthew's technique of calling CF from a command-line interface with the use of cURL. This idea got me thinking. Using cURL to pass URL parameters to a script is well and good if you are manually typing the calls, but... what if you want to automate the process and and pass dynamic data whenever a certain event happens on your server?
For instance, I often write PHP scripts to automatically handle responses to certain emails that have been sent in to our company. Emails containing unsubscribe requests are processed so that the corresponding email is removed from our newsletter list; support requests get an autoresponse and are passed on to certain personnel; and I've even written a script for a web-based project management site that redistributed any email it received to a dynamic list of project members. All of these tasks happened automatically, as soon as our mail server received an email. Now I've figured out how to do the same thing with ColdFusion-- and this will work without event gateways and even if your mail server is separate from your web server.
Continue reading "CF through a command-line interface part 2: programmatic calls" »
It's very convenient for users to be able to communicate with web applications (or businesses) via email, but it's not always easy for the employees of the company to respond. Some of the email requests could be complex, and others could be simple but occur very frequently. So it's a real advantage when we can write scripts to respond to user emails for us. Here are some of the many uses I've found for autoresponder scripts:
- Distributing emails to a dynamic, user-defined list of recipients;
- Handling unsubscribe requests and subsequent feedback;
- Auto-responding to support requests to let the user know their email has been received;
- Parsing email campaign bouncebacks and marking hard bounces as bad email addresses, and;
- Adding senders to a newsletter recipient list.
Fortunately, PHP fits nicely into the role of a scripting language which can talk to your application databases (to get user data), generate emails, and be called as a command-line interface by your mail program. That's the most important part-- many web languages support reading and sending emails and talking to your database, but few are accessible both as application servers and as command-line programs. I'll explain how to write such a script next.
Continue reading "Writing an Email Autoresponder Script with PHP" »