Make WordPress Core

Changeset 5188


Ignore:
Timestamp:
04/06/2007 02:57:46 AM (19 years ago)
Author:
rob1n
Message:

Add support to wp-mail.php for quoted-printable Content-Transfer-Encoding. Props Nazgul. fixes #2460

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-mail.php

    r5089 r5188  
    2525    $content = '';
    2626    $content_type = '';
     27    $content_transfer_encoding = '';
    2728    $boundary = '';
    2829    $bodysignal = 0;
    29     $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
    30                      'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
     30    $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
    3131    foreach ($message as $line) :
    3232        if (strlen($line) < 3) $bodysignal = 1;
     
    4040                $content_type = explode(';', $content_type);
    4141                $content_type = $content_type[0];
     42            }
     43            if (preg_match('/Content-Transfer-Encoding: /i', $line)) {
     44                $content_transfer_encoding = trim($line);
     45                $content_transfer_encoding = substr($content_transfer_encoding, 27, strlen($content_transfer_encoding)-14);
     46                $content_transfer_encoding = explode(';', $content_transfer_encoding);
     47                $content_transfer_encoding = $content_transfer_encoding[0];
    4248            }
    4349            if (($content_type == 'multipart/alternative') && (preg_match('/boundary="/', $line)) && ($boundary == '')) {
     
    112118    }
    113119    $content = trim($content);
     120   
     121    if (stripos($content_transfer_encoding, "quoted-printable") !== false) {
     122        $content = quoted_printable_decode($content);
     123    }
     124
    114125    // Captures any text in the body after $phone_delim as the body
    115126    $content = explode($phone_delim, $content);
    116127    $content[1] ? $content = $content[1] : $content = $content[0];
    117128
    118     echo "<p><b>Content-type:</b> $content_type, <b>boundary:</b> $boundary</p>\n";
     129    echo "<p><b>Content-type:</b> $content_type, <b>Content-Transfer-Encoding:</b> $content_transfer_encoding, <b>boundary:</b> $boundary</p>\n";
    119130    echo "<p><b>Raw content:</b><br /><pre>".$content.'</pre></p>';
    120131
Note: See TracChangeset for help on using the changeset viewer.