DotAdmin User Guide
The Unsubscribe Template
dotAdmin's mailing list system comes complete with an automated unsubscribe feature, which allows users to remove themselves from the mailing list at any time.
 The unsubscribe page
The unsubscribe template is broken down into four main elements. Firstly, there is the {message} element, which is displayed when a user first views the unsubscribe page. This would normally contain text explaining how to use the function:
<!--IF {message}-->
To unsubscribe from our mailing list,
please enter your email address below<br />
<!--/IF {message}-->
Unsubscribe template welcome message.
The {unsubscribed} element is displayed when a user is successfully unsubscribed from the mailing list:
<!--IF {unsubscribed}-->
The email address <b>{email}</b>
has been removed from our mailing list.<br />
<!--/IF {unsubscribed}-->
A typical “unsusbscribed” message, displaying the email address that has just been unsubscribed.
BLOCK {error}
This block will be displayed if an email address cannot be successfully removed from the mailing list. This can happen for one of two reasons:
- Badly formed email address
- If the email address is not a properly formatted email address, the
{bad_email} element will be displayed, or:
- The email address is not in the list
- If the email address which the user entered cannot be found in the mailing list, the
{not_found} element will be displayed.
The following code will display the appropriate error to the user in the event of an error:
<!--BLOCK {error}-->
<b>Error</b><br />
<!--IF {bad_email}-->
Sorry, the email address <b>{email}</b>
does not appear to be a valid email address.<br />
<!--/IF {bad_email}-->
<!--IF {not_found}-->
Sorry, we can't find the email address <b>{email}</b>
in our mailing list.<br />
<!--/IF {not_found}-->
Please re-enter your email address below:<br />
<!--/BLOCK {error}-->
Unsubscribe error output.
In the event of the user entering a valid email address (e.g: support@dotadmin.com) which is not in the mailing list, the above code would create the following output:
Error
Sorry, we can't find the email address support@dotadmin.com
in our mailing list.
BLOCK {form}
The {form} block will be displayed when the user first visits the unsubscribe page, or when an unsubscribe attempt fails, in which case the {email} element within the block will contain the failed email address. This allows us to use to following code to put a default value into the email input field when the unsusbscribe form is first viewed:
<!--BLOCK {form}-->
<form name="unsubscribe"
action="/content/unsubscribe" method="post">
<label for="email">Email :</label>
<!--IF {email}-->
<input style="width: 200px;" type="text"
name="email" value="{email}" />
<!--/IF {email}-->
<!--ELSE-->
<input style="width: 200px;" type="text"
name="email" value="Email Address"
onfocus="this.value='';" />
<!--/ELSE-->
<input type="submit" name="submit" value="Unsubscribe" />
</form>
<!--/BLOCK {form}-->
When the unsubscribe form is first viewed, it will contain the text “Email Address” in accordance with web accessibility guidelines.
Template Elements
Below is a list of all placeholders used in the Form template:
|
Placeholder
|
Output
|
|
{email}
|
This element contains the email address entered by the user, and can be used in all BLOCKs of the template.
|
|
IF {message}
|
This element is displayed when the user first views the unsubscribe page.
|
|
IF {unsubscribed}
|
This block is displayed if the email address enetred has been successfully unsubscribed.
|
|
BLOCK {error}
|
This block is displayed if there are problems with the submitted form, i.e. required fields which are missing and/or a badly formatted email address.
|
|
IF {bad_email}
|
Inside BLOCK {error}, this element will be displayed if the email address entered in the form is not properly formatted.
|
|
IF {not_found}
|
Inside BLOCK {error}, the element will be displayed if the email address entered in the form cannot be found in the mailing list.
|
|
BLOCK {form}
|
This BLOCK will displayed when the user first views the unsubscribe page, or when the address entered cannot be unsubscribed. In the case of the latter, the block will contain:
|
|
{email}
|
Inside BLOCK {form} This element contains the failed email address when an unsubscribe attempt has failed.
|
|