Remove list-unsubscribe in header

Edmund

New Member
Went through the forum for some details.
Understand from @twisted1919 that it is located in: apps/console/components/behaviors/CampaignSenderBehavior.php

Went in and try to comment out: 'List-Unsubscribe' => $listUnsubscribeHeaderValue, but somehow the email header still contains the list-unsubscribe. It creates that additional unsubscribe link in gmail beside the sender name which I want to remove.

The reason why we do not need this unsubscribe is because our client has their own unsubscribe process. Subscribers have to write in to request to unsubscribe and not via any online form.
 
@Edmund - /apps/console/commands/SendCampaignsCommand.php line ~916

You can also hook into the "console_command_send_campaigns_before_send_to_subscriber" (from an extension or from apps/init-custom.php file) and remove the header from there to be safe at upgrades:
PHP:
Yii::app()->hooks->addFilter('console_command_send_campaigns_before_send_to_subscriber', function($emailParams, $campaign, $subscriber, $customer, $server){
    foreach ($emailParams['headers'] as $index => $header) {
        if ($header['name'] == 'List-Unsubscribe') {
            unset($emailParams['headers'][$index]);
        }
    }
    return $emailParams;
});
 
@Edmund - /apps/console/commands/SendCampaignsCommand.php line ~916

You can also hook into the "console_command_send_campaigns_before_send_to_subscriber" (from an extension or from apps/init-custom.php file) and remove the header from there to be safe at upgrades:
PHP:
Yii::app()->hooks->addFilter('console_command_send_campaigns_before_send_to_subscriber', function($emailParams, $campaign, $subscriber, $customer, $server){
    foreach ($emailParams['headers'] as $index => $header) {
        if ($header['name'] == 'List-Unsubscribe') {
            unset($emailParams['headers'][$index]);
        }
    }
    return $emailParams;
});
I did not understand this clearly.Can you please give steps to remove this header?
Thanks in advance :)
 
Back
Top