You are here

function _smtp_boundary_split in SMTP Authentication Support 6

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 _smtp_boundary_split()
smtp_drupal_mail_wrapper in ./smtp.module
Sends out the e-mail.

File

./smtp.module, line 847
Enables Drupal to send e-mail directly to an SMTP server.

Code

function _smtp_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;
}