Skip to main content

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:

CategoryPurposeRequired
Opt-in confirmation pageLanding page after successful opt-in confirmationOptional
Expired opt-in pageInfo page when an opt-in link is expiredOptional
UnsubscribesLanding page for unsubscribesOptional
Notice target page(s)Error page for various failure casesOptional
Configure page URL

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

  1. Subscriber registers on your website
  2. Your website calls POST /subscribers/register at mail2many
  3. mail2many sends an opt-in mailing (valid for 7 days)
  4. Subscriber confirms within 7 days via the link in the mailing
  5. mail2many confirms and redirects to your confirmation page
  6. 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
info

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:

ParameterValueDescription
validtrue / falseIndicates whether the opt-in was still valid and confirmed

Logic:

  • valid=true → Show success confirmation
  • valid=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.

warning

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:

ParameterExampleDescription
unsubscribedtrue / falseIndicates whether unsubscribe was completed
pabcdef123Encrypted 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

  1. Subscriber clicks unsubscribe link in newsletter
  2. mail2many redirects to your unsubscribe page with parameters (unsubscribed=false)
  3. Subscriber sees your confirmation page: "Do you really want to unsubscribe?"
  4. Subscriber clicks "Confirm"
  5. Your page redirects back to mail2many with p and force=true
  6. mail2many unsubscribes and redirects back to your page (unsubscribed=true)
  7. 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:

ParameterExampleDescription
reasonCouldNotGetSubscriberIndicates the error reason

The page can evaluate reason and show a matching message — or use a generic error message.

Possible error reasons

ReasonContextDescription
CouldNotGetSubscriberUnsubscribeSubscriber was deleted in mail2many
CouldNotGetNewsletterBrowser versionNewsletter was deleted
BrowserVersionNotAvailableBrowser versionBrowser-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>
Alternative

You can also use a generic error page without evaluating the reason parameter if you do not need specific messages.