Veröffentlicht 25. Oktober 201212 j Hi, ich habe folgendes problem: sitze nun sied 3 tagen daran, einen mailclienten zu coden. der smtp-teil ist schon erldigt und kein Problem, jedoch beim pop-teil mangelt es am erfolg. bei einer werbemail, die ich direkt von yahoo erhalten habe, wird es richtig, als html angezeigt, schreibe ich jedoch eine testmail mit bissel text, oder hänge ich sgar nen anhang dran, zeigt er mir nur sch**** an. Hier der code: $imap = imap_open($server,$user,$passwd) or die("Could not open Mailbox - try again later!"); $content = imap_body($imap, $_GET['id']); echo utf8_decode($content);[/PHP] angezeigt wird mir, im schlechten fall: [code]This is a multipart message in MIME format. ------=_NextPart_000_0006_01CDB2A8.4B266630 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Dies ist eine testmail ^^ ------=_NextPart_000_0006_01CDB2A8.4B266630 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dies ist = eine testmail ^^ ------=_NextPart_000_0006_01CDB2A8.4B266630--[/code] habe mal nen var_dump der imap_fetchstructure gemacht: [CODE]object(stdClass)#1 (12) { ["type"]=> int(1) ["encoding"]=> int(0) ["ifsubtype"]=> int(1) ["subtype"]=> string(11) "ALTERNATIVE" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["bytes"]=> int(2101) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#2 (2) { ["attribute"]=> string(8) "BOUNDARY" ["value"]=> string(41) "----=_NextPart_000_0006_01CDB2A8.4B266630" } } ["parts"]=> array(2) { [0]=> object(stdClass)#3 (12) { ["type"]=> int(0) ["encoding"]=> int(0) ["ifsubtype"]=> int(1) ["subtype"]=> string(5) "PLAIN" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(2) ["bytes"]=> int(29) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#4 (2) { ["attribute"]=> string(7) "CHARSET" ["value"]=> string(8) "us-ascii" } } } [1]=> object(stdClass)#5 (12) { ["type"]=> int(0) ["encoding"]=> int(4) ["ifsubtype"]=> int(1) ["subtype"]=> string(4) "HTML" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(47) ["bytes"]=> int(1705) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#6 (2) { ["attribute"]=> string(7) "CHARSET" ["value"]=> string(8) "us-ascii" } } } } }[/code] leider habe ich da keinen eintrag "text" oder sonstwas gefunden, womit ich dann nur den inhalt angezeigt bekommen würde... hatte schon überlegt über nen explode das zu trennen, jedoch ist der unnütze teil bei jeder mail anders, und damit kann ich das ja wohl vergessen. Hat jemand eine idee, wie ich das hinbekomme?
26. Oktober 201212 j @flashpixx : Kurz und knackig Oder Mail_IMAPv2 Mail_Mime2 Mail_mimeDecode ..... Warum immer das Rad neu erfinden.... Bearbeitet 26. Oktober 201212 j von raiserle
Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.