Could anyone add this to the imap-module?
| From: | Ted Parnefors | Date: | Fri, 17 Mar 2000 16:14:33 +0000 |
| Subject: | Could anyone add this to the imap-module? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12335@lists.php.net to get a copy of this message | ||
So I finally got my first attempts at extending the imap-module to work,
however I know nothing about CVS. Maybe someone could add this to the
CVS tree in the imap-module, unless somebody else totally rejects it.
So what is it?
$array=imap_mime_header_decode($string);
Decodes mime elements that might appear in mail headers in accordance with
RFC 2047. It returns an array of objects, one object for each part in the
string that has different encodings. And each object has two properties,
namely "charset" & "text". "charset" is a string defining the
encoding of
the "text" that goes with it. (Such as "ISO-8859-1"), If any data isn't
encoded in the first place "charset" is set to the string "default".
Example php code:
<?php
$mystring="=?ISO-8859-1?q?Olle_J=E4rnefors?=<ojarnef@admin.kth.se>";
$myarray=imap_mime_header_decode($mystring);
echo "Elements: ".count($myarray)."\n";
for($i=0;$i<count($myarray);$i++) {
echo $myarray[$i]->charset."\n";
echo $myarray[$i]->text."\n";
}
?>
This would output the following:
Elements: 2
ISO-8859-1
Olle Järnefors
default
<ojarnef@admin.kth.se>
- CODE AS ATTATCHMENT
--
Ted Parnefors <ted@mtv.se>, KeyID 0x6627DEE4
PGP Fingerprint 1C39FA94703EB54A011CF18932018E256627DEE4