ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
679
679
EMPFEHLEN
-
Hallo!
ich habe mir ein Script geschrieben, mit dem ich meine Emails in einem Browserfenster darstellen kann. Nun habe ich mir eine Mail geschickt, die wie folgt aufgebaut ist:
Zum zerlegen einer Multipart-Msg habe ich mit folgende Funktion geschrieben:Code :1 2 3 4 5
Body |- Plain |- HTML Attachment |-JPEG
Funktionsweise ist diese: die PHP-Funktion imap_fetchstructure() liefert zu meiner Testmail folgende Struktur:PHP-Code:private function extractMultipartMsg($mailObj, $msgParts, $msgNr){
$i = 1;
if($msgParts->parts[0]->type == 1){
return $this->extractMultipartMsg($mailObj, $msgParts->parts[0], $msgNr);
}
foreach($msgParts->parts AS $msgPart){
if($msgPart->ifsubtype){
switch($msgPart->subtype){
case 'PLAIN': $mailObj->setMsgBody(imap_fetchbody($this->mbox, $msgNr, $i));
$mailObj->setMsgCharset($msgPart->parameters[0]->value);
break;
case 'HTML': $mailObj->setMsgHtml(imap_fetchbody($this->mbox, $msgNr, $i));
$mailObj->setMsgCharset($msgPart->parameters[0]->value);
break;
case 'JPEG': $att = new Attachment($msgPart->dparameters[0]->value, imap_fetchbody($this->mbox, $msgNr, $i));
$att->setFilesize($msgPart->bytes);
$mailObj->addAttachment($att);
break;
case 'PDF': $att = new Attachment($msgPart->dparameters[0]->value, imap_fetchbody($this->mbox, $msgNr, $i));
$att->setFilesize($msgPart->bytes);
$mailObj->addAttachment($att);
break;
}
$i++;
}
}
return $mailObj;
Hier ist deutlich zu sehen, das der erste Teil der Nachricht(also der Body) selbst nochmal in 2 Teile geteilt ist. Dies frage ich in der Zeile mitCode :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
object(stdClass)#9 (11) { ["type"]=> int(1) ["encoding"]=> int(0) ["ifsubtype"]=> int(1) ["subtype"]=> string(5) "MIXED" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#10 (2) { ["attribute"]=> string(8) "boundary" ["value"]=> string(36) "------------010200070206010707070907" } } ["parts"]=> array(2) { [0]=> object(stdClass)#11 (11) { ["type"]=> int(1) ["encoding"]=> int(0) ["ifsubtype"]=> int(1) ["subtype"]=> string(11) "ALTERNATIVE" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#12 (2) { ["attribute"]=> string(8) "boundary" ["value"]=> string(36) "------------040809060102070208050306" } } ["parts"]=> array(2) { [0]=> object(stdClass)#13 (12) { ["type"]=> int(0) ["encoding"]=> int(1) ["ifsubtype"]=> int(1) ["subtype"]=> string(5) "PLAIN" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(17) ["bytes"]=> int(382) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#14 (2) { ["attribute"]=> string(7) "charset" ["value"]=> string(11) "ISO-8859-15" } } } [1]=> object(stdClass)#15 (12) { ["type"]=> int(0) ["encoding"]=> int(1) ["ifsubtype"]=> int(1) ["subtype"]=> string(4) "HTML" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(23) ["bytes"]=> int(689) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#16 (2) { ["attribute"]=> string(7) "charset" ["value"]=> string(11) "ISO-8859-15" } } } } } [1]=> object(stdClass)#17 (13) { ["type"]=> int(5) ["encoding"]=> int(3) ["ifsubtype"]=> int(1) ["subtype"]=> string(4) "JPEG" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["bytes"]=> int(22236) ["ifdisposition"]=> int(1) ["disposition"]=> string(6) "inline" ["ifdparameters"]=> int(1) ["dparameters"]=> array(1) { [0]=> object(stdClass)#18 (2) { ["attribute"]=> string(8) "filename" ["value"]=> string(18) "imgp0001_klein.jpg" } } ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#19 (2) { ["attribute"]=> string(4) "name" ["value"]=> string(18) "imgp0001_klein.jpg" } } } } }ab und tauche damit nochmal eine Ebene in der Struktur ab. Soweit ich es mit Testausgaben nachvollziehen kann funktioniert das auch alles soweit.PHP-Code:if($msgParts->parts[0]->type == 1){
return $this->extractMultipartMsg($mailObj, $msgParts->parts[0], $msgNr);
}
Was allerdings passiert ist, dass er zwar die beiden Parts aus dem Bodybereich sauber erkennt aber die Inhalte nicht trennt. So erhalte ich sowohl den PLAIN- als auch den HTML-Body im Feld EMail::msgBody und das Bild landet im Feld EMail::msgHtml.
Warum das so ist, ist mir einfach schleierhaft.
Ich hoffe, Ihr könnt mir hier weiterhelfen.Signatur nicht verfügbar.
Ähnliche Themen
-
GUI Probleme
Von evoleena im Forum Java GrundlagenAntworten: 1Letzter Beitrag: 07.08.08, 15:00 -
IMAP > imap_fetchbody > Parts
Von MadCrusher im Forum PHPAntworten: 0Letzter Beitrag: 31.10.07, 15:49 -
Probleme mit ASP:NET
Von Darkas im Forum .NET Web und KommunikationAntworten: 2Letzter Beitrag: 10.09.07, 16:24 -
Premiere Pro Export probleme / Projekt Probleme
Von DanielT im Forum Videoschnitt, Videotechnik & -produktionAntworten: 5Letzter Beitrag: 31.10.03, 17:48 -
Probleme mit cout (War: Probleme bei meinem Programm)
Von DöDö im Forum C/C++Antworten: 6Letzter Beitrag: 21.05.03, 12:49





Zitieren
Login






[PHP][Snippet] Array zu XML konvertieren