Pages and Redirects
Pages and redirects let you configure custom landing pages and redirect targets for different processes in mail2many. This keeps subscribers in the familiar environment of your website throughout signup, unsubscribe, and confirmation flows.
Overview
Per account, you can configure different types of custom pages and redirects:
| Category | Purpose | Required |
|---|---|---|
| Opt-in confirmation page | Landing page after successful opt-in confirmation | Optional |
| Expired opt-in page | Info page when an opt-in link is expired | Optional |
| Unsubscribes | Landing page for unsubscribes | Optional |
| Notice target page(s) | Error page for various failure cases | Optional |
Store the URL in account settings under “Pages and Redirects”.
Opt-in confirmation page
Shows success after a valid opt-in confirmation. The confirmation itself happens in mail2many; your page acts as the landing page.
Benefit: Registration and confirmation page stay on the same website/domain.
Requirements:
- Page must be publicly reachable
- Can be built with any technology (including static)
- Recommended: Same domain as sender address (e.g. newsletter@atrivio.de → atrivio.de)
Flow
- Subscriber registers on your website
- Your website calls
POST /subscribers/registerat mail2many - mail2many sends an opt-in mailing (valid for 7 days)
- Subscriber confirms within 7 days via the link in the mailing
- mail2many confirms and redirects to your confirmation page
- Your page shows the confirmation
Example: Simple confirmation page
A simple HTML page could look like this:
<!doctype html>
<html lang="en">
<head>
<title>Newsletter signup confirmed</title>
</head>
<body>
<h1>Thank you for your confirmation.</h1>
<p>You have successfully subscribed to our newsletter.</p>
</body>
</html>
Expired opt-in page
This page is shown when a subscriber tries to confirm an expired opt-in (after 7 days). It informs about expiry and offers a way to register again.
Requirements:
- Page must be publicly reachable
- Can be built with any technology (including static)
- Recommended: Same domain as sender address
If confirmation happens after 7 days, it is not accepted and the user is redirected to this page.
Alternative: One single page
You can also use only one page for both cases (confirmation + expired). It evaluates the valid URL parameter:
| Parameter | Value | Description |
|---|---|---|
valid | true / false | Indicates whether the opt-in was still valid and confirmed |
Logic:
valid=true→ Show success confirmationvalid=false→ Show hint to register again
Example: Single-page solution with PHP
<?php
/**
* File: newsletter-confirmation.php
*
* This is a simple example without comprehensive validation
*/
// Read URL parameter
$isValid = isset($_REQUEST['valid']) && $_REQUEST['valid'] === 'true';
if ($isValid) {
$headline = 'Newsletter confirmation';
$message = 'You have successfully subscribed to our newsletter.';
} else {
$headline = 'Link expired';
$message = 'This link has expired and subscription could not be completed. Please register again on our website.';
}
?>
<!doctype html>
<html lang="en">
<head>
<title><?php echo htmlspecialchars($headline); ?></title>
</head>
<body>
<h1><?php echo htmlspecialchars($headline); ?></h1>
<p><?php echo htmlspecialchars($message); ?></p>
</body>
</html>
Unsubscribes
A custom unsubscribe page allows unsubscribes in your own environment. The actual unsubscribe is performed by mail2many; your page acts as an intermediate step.
Important: If the unsubscribe page is unavailable, subscribers cannot unsubscribe. Ensure high availability.
Preparation
Requirements:
- Page must be publicly reachable
- Recommended: Same domain as sender address
URL parameters from mail2many:
| Parameter | Example | Description |
|---|---|---|
unsubscribed | true / false | Indicates whether unsubscribe was completed |
p | abcdef123 | Encrypted parameter with mail2many unsubscribe data |
The page evaluates unsubscribed:
unsubscribed=false→ Show confirmation page with button "Confirm unsubscribe"unsubscribed=true→ Show success confirmation
On click "Confirm": Redirect back to mail2many with parameters p and force=true
Flow
- Subscriber clicks unsubscribe link in newsletter
- mail2many redirects to your unsubscribe page with parameters (
unsubscribed=false) - Subscriber sees your confirmation page: "Do you really want to unsubscribe?"
- Subscriber clicks "Confirm"
- Your page redirects back to mail2many with
pandforce=true - mail2many unsubscribes and redirects back to your page (
unsubscribed=true) - Subscriber sees unsubscribe confirmation
Example: Unsubscribe page with PHP
File: newsletter-unsubscribe.php
<?php
/**
* File: newsletter-unsubscribe.php
*
* This is a simple example without comprehensive validation
*/
// mail2many parameter (passed encrypted by mail2many)
$p = isset($_REQUEST['p']) ? $_REQUEST['p'] : '';
// Check if already unsubscribed
if (isset($_REQUEST['unsubscribed']) && $_REQUEST['unsubscribed'] === 'true') {
// Subscriber is unsubscribed, show success page
header('Location: /newsletter-unsubscribe-success.php');
exit;
}
// Check if button was clicked
if (isset($_REQUEST['buttonClicked']) && $_REQUEST['buttonClicked'] === 'true') {
// Subscriber clicked button, redirect to mail2many
// IMPORTANT: Replace URL with your mail2many instance
$unsubscribeUrl = 'https://api.mail2many.de/unsubscribe.php?force=true&p=' . urlencode($p);
header('Location: ' . $unsubscribeUrl);
exit;
}
// Subscriber wants to unsubscribe - show confirmation page
$confirmUrl = '?p=' . urlencode($p) . '&buttonClicked=true';
?>
<!doctype html>
<html lang="en">
<head>
<title>Unsubscribe newsletter</title>
</head>
<body>
<h1>Unsubscribe newsletter</h1>
<p>Do you no longer want to receive our newsletter?</p>
<p><a href="newsletter-unsubscribe.php<?php echo htmlspecialchars($confirmUrl); ?>">Unsubscribe now</a></p>
<p>With one click, you will be removed from our newsletter list.</p>
</body>
</html>
File: newsletter-unsubscribe-success.php
<!doctype html>
<html lang="en">
<head>
<title>Unsubscribe successful</title>
</head>
<body>
<h1>Unsubscribe successful</h1>
<p>Your newsletter unsubscribe was successful.</p>
<p>We would be happy to welcome you back again soon.</p>
</body>
</html>
Notice target page(s)
Custom notice target pages let you inform subscribers about errors in your own environment.
Preparation
Requirements:
- Page must be publicly reachable
- Recommended: Same domain as sender address
URL parameters from mail2many:
| Parameter | Example | Description |
|---|---|---|
reason | CouldNotGetSubscriber | Indicates the error reason |
The page can evaluate reason and show a matching message — or use a generic error message.
Possible error reasons
| Reason | Context | Description |
|---|---|---|
CouldNotGetSubscriber | Unsubscribe | Subscriber was deleted in mail2many |
CouldNotGetNewsletter | Browser version | Newsletter was deleted |
BrowserVersionNotAvailable | Browser version | Browser-version issue |
Example: Notice page with PHP
<?php
/**
* File: newsletter-notice.php
*
* This is a simple example without comprehensive validation
*/
// Read reason for error
$reason = isset($_REQUEST['reason']) ? $_REQUEST['reason'] : '';
// Default error message
$title = 'An error occurred';
$message = 'An error occurred. Please try again later or contact support.';
// Specific messages based on reason
switch ($reason) {
case 'CouldNotGetSubscriber':
$title = 'Subscriber not found';
$message = 'Your email address was not found in our system. You may already be unsubscribed.';
break;
case 'CouldNotGetNewsletter':
$title = 'Newsletter unavailable';
$message = 'The requested newsletter is no longer available.';
break;
case 'BrowserVersionNotAvailable':
$title = 'Browser version unavailable';
$message = 'The requested browser version is no longer available.';
break;
}
?>
<!doctype html>
<html lang="en">
<head>
<title><?php echo htmlspecialchars($title); ?></title>
</head>
<body>
<h1><?php echo htmlspecialchars($title); ?></h1>
<p><?php echo htmlspecialchars($message); ?></p>
<p>
<a href="/">Back to homepage</a>
</p>
</body>
</html>
You can also use a generic error page without evaluating the reason parameter if you do not need specific messages.