Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibraryOur Software in Action >  >Master Form V4 in Action

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Unsubscribe Form Processing with Master Form V4

In addition to processing subscription forms, one of many tasks Master Form V4 can perform for you, it can also process remove/unsubscribe/opt-out notices to subscription management software or list servers (and to yourself).

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 Form V4 takes these steps:

  1. Updates a database with the submitted information.

  2. Sends a remove request email to the list software/service. (The list software/service then handles the remove after it receives the email.)

  3. Sends an email to the removed subscriber.

  4. Sends an email to you, the webmaster.

  5. 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 Form V4 Manual.

List Removal Request Facilitation with Master Form V4

The same web page form, with JavaScript, is used for both

  1. the one-click removal system that automatically submits the form and
  2. 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.

Provide the email address being removed/unsubscribed:

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 Form V4 to print an initial record of field names whenever it creates a new database file.

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 Form V4 retrieves the template web page at the URL, personalizes/customizes it, then displays the modified web page in the user's browser.

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

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

Support Area – Ask Your Question Here

The "Code in articles help" forum at the Willmaster.com support area is the place to get information about implementing JavaScript and other software code found on Willmaster.com

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

Need Custom Software?
Click to
tell us about
your project.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC