You are here

protected function SMTPMailSystem::boundarySplit in SMTP Authentication Support 8

Splits the input into parts based on the given boundary.

Swiped from Mail::MimeDecode, with modifications based on Drupal's coding standards and this bug report: http://pear.php.net/bugs/bug.php?id=6495

Parameters

string $input: A string containing the body text to parse.

string $boundary: A string with the boundary string to parse on.

Return value

array An array containing the resulting mime parts

1 call to SMTPMailSystem::boundarySplit()
SMTPMailSystem::mail in src/Plugin/Mail/SMTPMailSystem.php
Send the e-mail message.

File

src/Plugin/Mail/SMTPMailSystem.php, line 681

Class

SMTPMailSystem
Modify the drupal mail system to use smtp when sending emails.

Namespace

Drupal\smtp\Plugin\Mail

Code

protected function boundarySplit($input, $boundary) {
  $parts = [];
  $bs_possible = substr($boundary, 2, -2);
  $bs_check = '\\"' . $bs_possible . '\\"';
  if ($boundary == $bs_check) {
    $boundary = $bs_possible;
  }
  $tmp = explode('--' . $boundary, $input);
  for ($i = 1; $i < count($tmp); $i++) {
    if (trim($tmp[$i])) {
      $parts[] = $tmp[$i];
    }
  }
  return $parts;
}