Skip to:
Content

BuddyPress.org

Changeset 11863


Ignore:
Timestamp:
02/21/2018 02:42:25 AM (8 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 (trunk)

File:
1 edited

Legend:

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

    r11763 r11863  
    10091009                $user = get_user_by( 'email', $tokens['recipient.email'] );
    10101010
    1011                 $headers['List-Unsubscribe'] = sprintf(
    1012                         '<%s>',
    1013                         esc_url_raw( bp_email_get_unsubscribe_link( array(
    1014                                 'user_id'           => $user->ID,
    1015                                 'notification_type' => $email->get( 'type' ),
    1016                         ) ) )
    1017                 );
     1011                $link = bp_email_get_unsubscribe_link( array(
     1012                        'user_id'           => $user->ID,
     1013                        'notification_type' => $email->get( 'type' ),
     1014                ) );
     1015
     1016                if ( ! empty( $link ) ) {
     1017                        $headers['List-Unsubscribe'] = sprintf( '<%s>', esc_url_raw( $link ) );
     1018                }
    10181019        }
    10191020
Note: See TracChangeset for help on using the changeset viewer.