You are here

public static function Conversion::swiftmailer_is_path_header in Swift Mailer 8.2

Same name and namespace in other branches
  1. 8 src/Utility/Conversion.php \Drupal\swiftmailer\Utility\Conversion::swiftmailer_is_path_header()

Checks whether a header is a path header.

It is difficult to distinguish id, mailbox and path headers from each other as they all may very well contain the exact same value. This public static function simply checks whether the header key equals to 'Return-Path' to determine if the header is a path header.

Parameters

string $key: The header key.

string $value: The header value.

Return value

bool TRUE if the provided header is a path header, and otherwise FALSE.

See also

http://swift_mailer.org/docs/header-path

1 call to Conversion::swiftmailer_is_path_header()
Conversion::swiftmailer_get_headertype in src/Utility/Conversion.php
Determines the header type based on the a header key and value.

File

src/Utility/Conversion.php, line 310

Class

Conversion
@todo

Namespace

Drupal\swiftmailer\Utility

Code

public static function swiftmailer_is_path_header($key, $value) {
  if ($key == 'Return-Path' && \Drupal::service('email.validator')
    ->isValid($value)) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}