Autoresponder FeaturesDec 3, 2013 at 8:52 am
An autoresponder is used in marketing to send emails in response to a visitor to a website submitting their email details to a web form.
The web form typically has input fields for Name and Email together with a submit button. Clicking on the submit button, sends the name and email via the POST method to a web page (sometimes the same page) for processing via a server-side script.
The POST method keeps the data hidden from public view. And to ensure that the data is sent from the form rather than somewhere else, a cookie is used to track where the data came from i.e. the cookie is set on the submit form page.
This script stores the data on the server, acknowledges the submission to the visitor, and may immediately send the visitor an email. This is done to ensure that the owner of the email was the person submitting it to the form. This confirmation email will contain a link back to a script that flags that the email has been confirmed. Such a scheme is known as double opt-in and is a legal requirement in some countries such as the UK.
Once the subscriber has been confirmed, emails may be sent to them, but these should contain an unsubscribe link. This link points to a script that removes the subscriber from a list.
It’s possible that an attacker could try to delete emails from a list by forming the required URLs, but it seems unlikely, since they would have to guess the emails in the list. Nevertheless, the email should be encoded in some way in the URL to demonstrate an effort to keep it private.
This script uses the MD5 hashing algorithm to encode email addresses. And the value is used as a key to point to any data associated with a particular subscriber.
From the above discussion, it is apparent that web pages are required to perform the following functions:
- Display a subscribe form to the visitor, and set a browser cookie
- Receive POST data, check for the cookie, and send a confirmation email
- Respond to the confirm link being clicked
- Respond to the unsubscribe link being clicked
So these pages need code to do background processing, and display information to the visitor. There are various ways to implement these pages depending on the platform used to deliver the website. For example, hard-coded web pages or by means of a plugin.
To send the email, the PHP sendmail function could be used, but it has limited functionality. Instead we use PHPMailer which is a library of code that has a comprehensive number of setting parameters, and provides useful debugging messages.
To schedule the sending of emails, we need some form of timer to trigger the script. This may be via a CRON JOB on a Linux server which may be set up via the cPanel. The timer settings are entered, and the path to the executable script. For example, the script could be run every 5 minutes.
Another method is by triggering a script every time a web page is requested. This script checks the system time to see if it is time to perform a new action. The problem with this method is that the web page may not be requested often enough with a low traffic web site.
The rate of sending emails needs to be considered in respect of the size of your list, the frequency that you want to send, and the limitations imposed on you by your hosting provider.
Time intervals used by the autoresponder:
- Day – used to limit the total number of emails sent per day
- Sending interval – how long to wait to send another email to a subscriber
- Clock tick – how frequently to trigger another email to be sent
Of course, nothing is sent if there are no emails left in the queue.
Your sending email will be one that you set up such as via cPanel. The email account will have the email address, an out-going mail server address, a password, and a port.
Mail received by this address should be taken notice of since it may reveal bounced emails which need to be removed from your list, as well as correspondence from your subscribers. So you can set up an email box, and/or forward the email to your main email address.
It is useful to customize emails with say the name of a subscriber, so tokens are used as place-holders for this purpose e.g. NAME will be replaced by the subscriber’s name.
Broadcast emails are those that are sent to every subscriber. These take priority over autoresponder sequence emails.
Autoresponder sequence emails are like a queue of emails to be sent at particular time intervals after a person subscribes. So the position in the queue may be indicated by a number attached to the email file name. If the positions relate to days, some days may be skipped to vary the frequency of the delivery.
So that is an over-view of the thinking behind this script implementation. Other autoresponder features will be some admin tools such as to administer the subscriber list. Anyway, more posts to follow …