You are here

protected function SmtpMailSystem::_boundary_split in SMTP Authentication Support 7

Same name and namespace in other branches
  1. 7.2 smtp.mail.inc \SmtpMailSystem::_boundary_split()

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

input: A string containing the body text to parse.

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

Return value

An array containing the resulting mime parts

1 call to SmtpMailSystem::_boundary_split()
SmtpMailSystem::mailWithoutQueue in ./smtp.mail.inc

File

./smtp.mail.inc, line 699
The code processing mail in the smtp module.

Class

SmtpMailSystem
Modify the drupal mail system to use smtp when sending emails. Include the option to choose between plain text or HTML

Code

protected function _boundary_split($input, $boundary) {
  $parts = array();
  $bs_possible = drupal_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;
}