Body; if ( self::$own > 0 ) { if ( false === stripos( (string) $phpmailer->ContentType, 'html' ) ) { $phpmailer->ContentType = 'text/html'; $phpmailer->CharSet = 'UTF-8'; } return; } if ( true !== Settings::get( 'brand_member_mail' ) || ! method_exists( $phpmailer, 'getToAddresses' ) || str_contains( $body, BrandedRenderer::MARKER ) ) { return; } $branding = null; foreach ( (array) $phpmailer->getToAddresses() as $address ) { $user = get_user_by( 'email', (string) ( $address[0] ?? '' ) ); if ( ! $user instanceof \WP_User || ProtectedAccounts::is_protected( (int) $user->ID ) ) { continue; } $branding = Services::orgs()->branding_for_user( (int) $user->ID ); if ( null !== $branding ) { break; } } if ( ! $branding instanceof OrgBranding ) { return; } $html = false !== stripos( (string) $phpmailer->ContentType, 'html' ) ? $body : make_clickable( nl2br( esc_html( $body ) ) ); $plain = '' === trim( (string) $phpmailer->AltBody ) ? trim( wp_strip_all_tags( $body ) ) : (string) $phpmailer->AltBody; $phpmailer->Body = Services::branded_renderer()->render( $branding->org_id, $branding->lang, (string) $phpmailer->Subject, $html ); $phpmailer->ContentType = 'text/html'; $phpmailer->CharSet = 'UTF-8'; $phpmailer->AltBody = $plain; $phpmailer->FromName = '' !== $branding->sender_name ? $branding->sender_name : $branding->name; } }