• We value your experience with Plesk during 2026
    Please help us understand which Plesk features made your work easier this year, what is still missing and how AI should help you in Plesk ?
    Take this short 5-minutes survey. Your answers go straight into the Plesk roadmap for 2027.

Issue Plesk and Postfix Handling of Unsubscribe Email Headers

tetrahall

Regular Pleskian
Server operating system version
Centos 7
Plesk version and microupdate number
Plesk Obsidian 18.0.82.3
Hello,

We are sending emails to subscribed members and wish to add "Unsubscribe" buttons to them. We use PHPMailer 6.0.7. The sending script contains the following headers:

Code:
        $mail->addCustomHeader(
            'List-Unsubscribe',
            '<https://www.domain.com/unsubscribe.php?UserNum=' . rawurlencode($UserNum) . '&token=' . rawurlencode($token) . '>'
        );

        $mail->addCustomHeader(
            'List-Unsubscribe-Post',
            'List-Unsubscribe=One-Click'
        );

However, no "Unsubscribe" buttons are displayed in received emails (gmail, hotmail and Yahoo).

The relevant headers in the received emails are:
Code:
List-Unsubscribe: <https://www.domain.com/unsubscribe.php?UserNum=120884&token=...hidden...>
List-Unsubscribe-Post: List-Unsubscribe=One-Click

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=domain.com; s=default; t=1796108921; bh=VMqMl9Szk1pvDM4umSkNpOFXw8U63CP6DbV1S4BiOMM=; h=Received:To:From:Subject; b=Chi0S4hi55dflNMHsZsmD3ZysTjf97AO+e3FuZPNLYdrnGn2DMNyTBUK3MWPXunQw ryAGtL7htoNcZkbwTd23OfO8oYCSJdWmTVaP+TOk5G8

Is this caused by Plesk affectig the sent headers in any way?

I'd greatly appreciate your advice.

Tetrahall
 
Hello,

Plesk does not remove or change these headers. The problem is in the DKIM signature that Plesk adds to outgoing mail.

Gmail and Yahoo show the one-click "Unsubscribe" button only when a DKIM signature covers both List-Unsubscribe and List-Unsubscribe-Post (RFC 8058). The Plesk DKIM signer signs a fixed list of headers. Your header shows it: h=Received:To:From:Subject. Thus the unsubscribe headers are not signed, and the mail providers ignore them.

We registered this issue as PPPM-15646, to fix it in a future update.

Workaround until the fix is available: sign the message in PHPMailer with a DKIM key for a subdomain of your domain. Plesk removes an existing DKIM signature only when its d= is the same as the sender domain. Thus a signature for a subdomain stays in the message, next to the Plesk signature.

1. Create a key pair for a subdomain, for example news.domain.com, with the selector s1. Keep the private key outside the document root, readable by the PHP user:
Code:
openssl genrsa -out s1.private 2048
openssl rsa -in s1.private -pubout -outform der | base64 -w0
Add a TXT record to the DNS zone of domain.com:
Code:
s1._domainkey.news.domain.com  TXT  "v=DKIM1; k=rsa; p=<output of the second command>"

2. Add these lines to your script:
PHP:
$mail->DKIM_domain = 'news.domain.com';
$mail->DKIM_selector = 's1';
$mail->DKIM_private = '/path/to/s1.private';
$mail->DKIM_extraHeaders = ['List-Unsubscribe', 'List-Unsubscribe-Post'];
$mail->DKIM_copyHeaderFields = false;
The last line is necessary for PHPMailer 6.0.7. That version writes an incorrect z= tag, and then the signature is not valid. A current PHPMailer version does not have this problem, so after an update you can remove the line.

3. Make sure that the DMARC record of domain.com does not contain adkim=s. With the default relaxed alignment, a signature for news.domain.com aligns with your From address.

We tested this on Plesk 18.0.82: both signatures verify, and the PHPMailer signature covers both unsubscribe headers. Note that Gmail and Yahoo also use the sender reputation and the mail volume to decide when they show the button, and the unsubscribe URL must accept a POST request.
 
Back
Top