Unsubscribe Form Processing with Master Form V4
In addition to processing subscription forms, one of many tasks Master
This article shows you how to implement two different remove/unsubscribe/opt-out methods: A one-click remove/unsubscribe/opt-out link for your email publications. And it shows you how to implement a traditional form for the same purpose.
If you implement the one-click remove link, the web page being linked to automatically provides the remove form, as required.
The form is automatically submitted when the one-click link is used successfully. Otherwise, it displays a form that requires the subscriber to enter the remove address.
When the form is submitted, automatically or manually, Master
-
Updates a database with the submitted information.
-
Sends a remove request email to the list software/service. (The list software/service then handles the remove after it receives the email.)
-
Sends an email to the removed subscriber.
-
Sends an email to you, the webmaster.
-
Presents a "thank you" page to the removed subscriber.
Forms, emails, databases, and "thank you" pages can all be formatted the way you want and contain the information you want.
I'll show you how to do it, step by step. If anything is unclear, or if you wish to modify the examples provided here, please consult the Master
List Removal Request Facilitation with Master Form V4
The same web page form, with JavaScript, is used for both
- the one-click removal system that automatically submits the form and
- the manual system that requires the form user to fill in the remove address and click the submit button.
For the one-click removal system, the subscriber wishing to be removed would click a remove link. The remove link URL is constructed like this:
http://example.com/remove.html?[[email]]
It's the URL to the remove form web page with a question mark and the subscriber's email address appended.
Here is an example web page for both systems:
<html> <body> <script type="text/javascript" language="JavaScript"> <!-- Copyright 2005 Bontrager Connection, LLC Addy = new String(); var thisurl = document.URL; var questionlocation = thisurl.indexOf('?'); if(questionlocation > 0) { Addy = thisurl.substr(questionlocation + 1); } if(Addy.length > 0) { Addy = unescape(Addy); } //--> </script> <form name="autoOptOut" method="POST" action="/cgi-bin/v4/MasterFormV4.cgi"> <input type="hidden" name="requiredfields" value="email"> <input type="hidden" name="emailfields" value="email"> <input type="hidden" name="dbfile" value="data/removedata.csv"> <input type="hidden" name="filetemplate" value="templates/removedata.txt"> <input type="hidden" name="emailtemplate" value="templates/remove_listserveremail.txt"> <input type="hidden" name="emailtemplate" value="templates/remove_subscriberemail.txt"> <input type="hidden" name="emailtemplate" value="templates/remove_webmasteremail.txt"> <input type="hidden" name="flowto" value="/remove_confirmation.html"> <script type="text/javascript" language="JavaScript"><!-- if(Addy.length > 0) { document.write('<input type="hidden" name="email">'); } else { document.write('<p>Provide the email address being removed/unsubscribed:<br>'); document.write('<input type="text" name="email" size="33"></p>'); document.write('<p><input type="submit" value="Remove"></p>'); } //--></script> <noscript> <p>Provide the email address being removed/unsubscribed:<br> <input type="text" name="email" size="33"></p> <p><input type="submit" value="Remove"></p> </noscript> </form> <script type="text/javascript" language="JavaScript"><!-- if(Addy.length > 0) { document.autoOptOut.email.value = Addy; document.autoOptOut.submit(); } //--></script> </body> </html>
Verify the URLs in the FORM tag and the hidden fields are correct. Adjust as necessary.
The remove form automatically submits if the subscriber's browser is JavaScript-enabled and an email address was appended to the remove link URL. Otherwise, a form will print on the page. In that case, here is how the above form would print.
You can publish a one-click removal link. Or you can link directly to the web page with the form. The same web page works for both with the above system.
Following is a short explanation of each hidden field, along with an example if the hidden field refers to a template.
Hidden field name="requiredfields"
This hidden field's value contains a comma-separated list of the field names that are required to contain information before the form can be successfully submitted.
Hidden field name="emailfields"
This hidden field's value contains a comma-separated list of the field names that must contain a correctly formatted email address if they contain any information at all.
Hidden field name="dbfile"
The file name and location of the database is specified here. Information submitted with the form is appended to the file, the file created if it doesn't already exist.
Hidden field name="filetemplate"
The template specified in this hidden field is used to prepared the data record prior to appending to the database file. Here is an example database record template:
**INITIALIZE_DATABASE_WITH_FIELD_NAMES** "[[WEEKDAY]], [[LONGMONTH]] [[DAY]], [[YEAR]]","[[HOUR2]]:[[MINUTE2]]:[[SECOND2]]","[[email]]","[[IP]]"
The above is a template for a comma-separated values (CSV) file, recording
- the server date,
- the server time,
- the email address provided on the form, and
- the IP address of the form user.
The first line of the template tells Master
Hidden field name="emailtemplate" (three)
Three email templates are used for the list software/service, for the removed subscriber, and for you, the webmaster.
Here is an example email template for the list software/server:
Return-Path: <[[email]]> From: [[email]] Reply-To: [[email]] To: listserver@example.com Subject: Unsubscribe [[email]] Unsubscribe [[email]]
Here is an example email template for the removed subscriber:
To: [[email]] From: "Ezine LLC" <ezine@example.com> Subject: [[email]] has been removed from the Ezine list We're sorry to see you go. If this removal was in error, please go to http://example.com/subscribe.html and re-subscribe. Webmaster Ezine LLC
Here is an example email template for you, the webmaster:
From: [[email]] To: webmaster@example.com Subject: Subscription Removal [[email]] has requested to be removed. IP Address [[IP]]
Hidden field name="flowto"
If you do not wish to have the "thank you" page personalized, use hidden field name="redirect" instead of name="flowto"
When hidden field name="flowto" is used, Master
Here is an example "thank you" web page template:
<html> <body> <p> The removal of [[email]] from the list has been initiated. </p> <p> It may take a few days to complete the process. </p> </body> </html>
Implementation
Put the web page with the form on your server, and the templates in the locations specified in the form's hidden fields
Then test it. Verify that all emails are sent and the database is updated.
Will Bontrager