Skip to:
Content

BuddyPress.org

Changeset 11862


Ignore:
Timestamp:
02/21/2018 02:41:41 AM (6 years ago)
Author:
r-a-y
Message:

Emails: Only add the 'List-Unsubscribe' header if we have a valid unsubscribe link.

Previously, we were adding a blank 'List-Unsubscribe' header for activation
and change of email address emails. This caused delivery issues for those
using Outlook.com as their email address. It appears that Outlook.com
requires a valid 'List-Unsubscribe' header in order for the email to be
received.

This commit fixes this by only adding the 'List-Unsubscribe' header if we
have a valid email unsubscribe link.

Props jcrr.

See #7697 (2.9-branch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.9/src/bp-core/bp-core-filters.php

    r11541 r11862  
    10121012        $user = get_user_by( 'email', $tokens['recipient.email'] );
    10131013
    1014         $headers['List-Unsubscribe'] = sprintf(
    1015             '<%s>',
    1016             esc_url_raw( bp_email_get_unsubscribe_link( array(
    1017                 'user_id'           => $user->ID,
    1018                 'notification_type' => $email->get( 'type' ),
    1019             ) ) )
    1020         );
     1014        $link = bp_email_get_unsubscribe_link( array(
     1015            'user_id'           => $user->ID,
     1016            'notification_type' => $email->get( 'type' ),
     1017        ) );
     1018
     1019        if ( ! empty( $link ) ) {
     1020            $headers['List-Unsubscribe'] = sprintf( '<%s>', esc_url_raw( $link ) );
     1021        }
    10211022    }
    10221023
Note: See TracChangeset for help on using the changeset viewer.