tutorials.de Buch-Aktion 05/2012
Seite 1 von 2 12 LetzteLetzte
ERLEDIGT
JA
ANTWORTEN
21
ZUGRIFFE
1978
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Avatar von mckani
    mckani mckani ist offline Mitglied Gold
    Registriert seit
    Sep 2005
    Ort
    Geboren und Wohne In Dinslaken (Deutschland)
    Beiträge
    229
    hallo ihr,

    Ich hab da mal wieder eine frage unzwar gehts um einen formmail.
    ich habe den formmail von tutorials.de also von der tutorial section
    hier die code
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    <?php 
    $admin = "webmaster@domain.de"; 
    $subject = "Formular wurde ausgefüllt!"; 
     
    while(list($name,$value)=each($HTTP_POST_VARS)) { 
    $message.="$name: $value\n\n"; 
    } 
     
    mail($admin,$subject,$message,"From: $mail"); 
     
    echo "Vielen Dank für das Ausfüllen des Formulares!" 
     
    ?>

    ich wollte wissen, OB es möglich ist einen Datei in Anhang zu legen.
    ABER dieses datei soll ein Standart datei sein der schon auf mein server ist z.B (anhang.zip)
    Ich habe hier im forum gesucht, aber nix gefunden was mir weiterhelfen kann.!
    es sollte für php4 und kein imap sender sein.!

    Ich hoffe einer von euch kann mir weiter helfen..

    Danke Voraus..
    Mfg
     
    14 Tage Urlaub ->
    14 Tage Rückgaberecht ->
    14 Tage Se.... ->

    PHP-Code:
    <?php
    if ($mckanionline == "yes"){
    echo 
    ' Alam ';}
    else{
    echo 
    ' Dead ';
    }
    ?>

  2. #2
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Ja, man kann eine Datei, oder auch mehrere anhaengen.
    Ich hab da irgendwo ein Script zu rumfliegen. Das hatte ich aber auch schonmal hier gepostet.

    Uebrigens: Statt $HTTP_POST_VARS sollte besser $_POST genutzt werden.
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  3. #3
    Avatar von mckani
    mckani mckani ist offline Mitglied Gold
    Registriert seit
    Sep 2005
    Ort
    Geboren und Wohne In Dinslaken (Deutschland)
    Beiträge
    229
    k ich ändere es um auf
    $_POST

    ich hab da einige post von dir gesehen aber keins der mir weiterhelfen würd
     
    14 Tage Urlaub ->
    14 Tage Rückgaberecht ->
    14 Tage Se.... ->

    PHP-Code:
    <?php
    if ($mckanionline == "yes"){
    echo 
    ' Alam ';}
    else{
    echo 
    ' Dead ';
    }
    ?>

  4. #4
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Ich schau mal nach ob ich das Script finde.
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  5. #5
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    So, ich hab da was gefunden.
    Bitte bitte klick mich an.

    Wie schon in dem Post steht ist die Klasse fuer PHP5 geschrieben und muesste fuer PHP4 ein klein wenig angepasst werden.
    Die Aenderungen sind aber nicht so wild. Wenn die dann fuer PHP4 angepasst ist funktioniert sie auch in der Form mit PHP5, falls Du dann mal umsteigst.

    Der Versand erfolgt mittels imap_mail(), das kann aber durch mail() ersetzt werden. Die Funktionen sind laut Doku wohl identisch.
    Ich nutze imap_mail weil das Script aus einem Webmailer kommt an dem ich (immer noch) arbeite.

    Die Funktion imap_8bit() ist so eine Sache.
    Entweder verzichtest Du darauf die Mail korrekt als Quoted-Printable zu verschicken und verschickst sie einfach direkt als 8Bit-Mail, oder Du musst die Funktion ersetzen.
    Du koenntest den Mailbody z.B. auch als Base64 encoden.
    Und in der Doku zu imap_8bit() gibt es auch eine Funktion die imap_8bit() ersetzen kann, so wie ich das sehe.
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  6. #6
    Avatar von mckani
    mckani mckani ist offline Mitglied Gold
    Registriert seit
    Sep 2005
    Ort
    Geboren und Wohne In Dinslaken (Deutschland)
    Beiträge
    229
    ok ich schau mir das mal an.

    nur wollt ich dich noch was fragen. *g*

    Bist wirklich aus Hong Kong ?
     
    14 Tage Urlaub ->
    14 Tage Rückgaberecht ->
    14 Tage Se.... ->

    PHP-Code:
    <?php
    if ($mckanionline == "yes"){
    echo 
    ' Alam ';}
    else{
    echo 
    ' Dead ';
    }
    ?>

  7. #7
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Viel Erfolg.
    Und immer daran denken: Bei Fragen: fragen!


    Ja, ich leb wirklich in Hong Kong.
    Bin aber gebuertig aus Deutschland.
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  8. #8
    Avatar von mckani
    mckani mckani ist offline Mitglied Gold
    Registriert seit
    Sep 2005
    Ort
    Geboren und Wohne In Dinslaken (Deutschland)
    Beiträge
    229
    jo ich frag doch gern, danke
    Ich bin aus Dinslaken kennst Ganzbestimmt :P Nachber *g* oder EXnachber

    Naja ich hau mir das ding Jetzt mal an. ThX nOchma
     
    14 Tage Urlaub ->
    14 Tage Rückgaberecht ->
    14 Tage Se.... ->

    PHP-Code:
    <?php
    if ($mckanionline == "yes"){
    echo 
    ' Alam ';}
    else{
    echo 
    ' Dead ';
    }
    ?>

  9. #9
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Ja. Ist ja gleich neben der alten Heimat. Am Ende der A59.

    In diesem Tutorial hab ich eine Klasse sowohl fuer PHP5 als auch fuer PHP4 gepostet. Da kannst Du Dir dann die Unterschiede ansehen.
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  10. #10
    Avatar von mckani
    mckani mckani ist offline Mitglied Gold
    Registriert seit
    Sep 2005
    Ort
    Geboren und Wohne In Dinslaken (Deutschland)
    Beiträge
    229
    jo da am ände von Walsum...

    naja ich hab hier mal das umgeändert auf php4
    Code :
    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
    
    <?php 
    class email 
    { 
        var $id; 
        var $to; 
        var $subject; 
        var $body; 
        var $from; 
        var $cc; 
        var $bcc; 
        var $attachedfiles; 
     
        function __construct($to,$subject,$body,$from="",$cc="",$bcc="") 
        { 
            $this->id=md5(uniqid()); 
            $this->to=$to; 
            $this->subject=$subject; 
            $this->body=$body; 
            $this->from=$from; 
            $this->cc=$cc; 
            $this->bcc=$bcc; 
            $this->attachedfiles=array(); 
        } 
     
        function destroy() 
        { 
            if (file_exists("mailtemp/".$this->id)) 
                { 
                    for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                        { 
                            unlink("mailtemp/".$this->id."/".$this->attachedfiles[$attachment]); 
                        } 
                    rmdir("mailtemp/".$this->id); 
                } 
        } 
     
        function attachfile($tempfile,$filename) 
        { 
            if (!file_exists("mailtemp/".$this->id)) 
                { 
                    mkdir("mailtemp/".$this->id); 
                } 
            move_uploaded_file($tempfile,"mailtemp/".$this->id."/".$filename); 
            $this->attachedfiles[]=$filename; 
        } 
     
        function removeattachment($filename) 
        { 
            unlink("mailtemp/".$this->id."/".$filename); 
            $newattachedfiles=array(); 
            for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                { 
                    if ($this->attachedfiles[$attachment]!=$filename) 
                        { 
                            $newattachedfiles[]=$this->attachedfiles[$attachment]; 
                        } 
                } 
            $this->attachedfiles=$newattachedfiles; 
            unset($newattachedfiles); 
        } 
     
        function send() 
        { 
            $body=imap_8bit($this->body); 
            $body.="\n\n"; 
            $boundary="----".$this->id; 
            $email=""; 
            $email.="Content-class: urn:content-classes:message"; 
            $email.="\nUser-Agent: Free WebMail"; 
            $email.="\nMIME-Version: 1.0"; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\nContent-Type: multipart/mixed;\n\tboundary=\"".$boundary."\""; 
                } 
            if (!empty($this->from)) 
                { 
                    $email.="\nFrom: ".$this->from; 
                } 
            if (!empty($this->cc)) 
                { 
                    $email.="\nCc: ".$this->cc; 
                } 
            if (!empty($this->bcc)) 
                { 
                    $email.="\nBcc: ".$this->bcc; 
                } 
            $email.="\nX-Priority: 3 (Normal)"; 
            $email.="\nImportance: Normal"; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\n\n--".$boundary; 
                } 
            $email.="\nContent-Type: text/plain;\n\tcharset=\"iso-8859-1\""; 
            $email.="\nContent-Transfer-Encoding: quoted-printable"; 
            $email.="\nContent-Disposition: inline"; 
            $email.="\n\n".$body; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\n\n--".$boundary; 
                } 
            for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                { 
                    $file=fopen("mailtemp/".$this->id."/".$this->attachedfiles[$attachment],"r"); 
                    $content=fread($file,filesize("mailtemp/".$this->id."/".$this->attachedfiles[$attachment])); 
                    fclose($file); 
                    $encodedfile=chunk_split(base64_encode($content)); 
                    $email.="\nContent-Type: application/octet-stream;\n\tname=\"".$this->attachedfiles[$attachment]."\""; 
                    $email.="\nContent-Transfer-Encoding: base64"; 
                    $email.="\nContent-Description: ".$this->attachedfiles[$attachment]; 
                    $email.="\nContent-Disposition: attachment;\n\tfilename=\"".$this->attachedfiles[$attachment]."\""; 
                    $email.="\n\n".$encodedfile."\n\n--".$boundary; 
                } 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="--"; 
                } 
            mail($this->to,$this->subject,"",$email); 
        } 
    } 
     
    function mailstring($mailobject) 
    { 
        return rawurlencode(serialize($mailobject)); 
    } 
     
    function mailobject($mailstring) 
    { 
        return unserialize(stripslashes(rawurldecode($mailstring))); 
    } 
    ?>

    Ich hoffe das ich nix versehen habe.!
    Aber ich hab wirklich Keine ahnung wie ich das mit dem imap_8bit machen soll hab in Doku. Nix gesehen wo steht womit man es ersätzen kann. :-/
    Geändert von mckani (08.10.05 um 17:01 Uhr)
     
    14 Tage Urlaub ->
    14 Tage Rückgaberecht ->
    14 Tage Se.... ->

    PHP-Code:
    <?php
    if ($mckanionline == "yes"){
    echo 
    ' Alam ';}
    else{
    echo 
    ' Dead ';
    }
    ?>

  11. #11
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Sieht ganz gut aus.
    Ich denke mal die sollte so laufen.

    Ich hab Dir die Funktion mal aus der Doku kopiert.
    PHP-Code:
       function quoted_printable($string)
       {
           
    $crlf    "\n" ;
           
    $string  preg_replace('!(\r\n|\r|\n)!'$crlf$string) . $crlf ;
           
    $f[]    = '/([\000-\010\013\014\016-\037\075\177-\377])/e' ;
           
    $r[]    = "'=' . sprintf('%02X', ord('\\1'))" ;
           
    $f[]    = '/([\011\040])' $crlf '/e' ;
           
    $r[]    = "'=' . sprintf('%02X', ord('\\1')) . '" $crlf "'" ;
           
    $string  preg_replace($f$r$string) ;
           return 
    trim(wordwrap($string70' =' $crlf)) ;
       } 
    Die sollte es eigentlich tun. Hab sie aber nicht getestet.
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  12. #12
    Avatar von mckani
    mckani mckani ist offline Mitglied Gold
    Registriert seit
    Sep 2005
    Ort
    Geboren und Wohne In Dinslaken (Deutschland)
    Beiträge
    229
    hmmm
    ich bekomm
    Code :
    1
    
    Fatal error: Call to undefined function: quoted_printable() in /home/www/webxx/html/mail/email.class.php on line 77
    :'(
    Code :
    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
    
     
    <?php 
    class email 
    { 
        var $id; 
        var $to; 
        var $subject; 
        var $body; 
        var $from; 
        var $cc; 
        var $bcc; 
        var $attachedfiles; 
     
    function quoted_printable($string) 
       { 
           $crlf    = "\n" ; 
           $string  = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf ; 
           $f[]    = '/([\000-\010\013\014\016-\037\075\177-\377])/e' ; 
           $r[]    = "'=' . sprintf('%02X', ord('\\1'))" ; 
           $f[]    = '/([\011\040])' . $crlf . '/e' ; 
           $r[]    = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'" ; 
           $string  = preg_replace($f, $r, $string) ; 
           return trim(wordwrap($string, 70, ' =' . $crlf)) ; 
       } 
     
        function __construct($to,$subject,$body,$from="",$cc="",$bcc="") 
        { 
            $this->id=md5(uniqid()); 
            $this->to=$to; 
            $this->subject=$subject; 
            $this->body=$body; 
            $this->from=$from; 
            $this->cc=$cc; 
            $this->bcc=$bcc; 
            $this->attachedfiles=array(); 
        } 
     
        function destroy() 
        { 
            if (file_exists("mailtemp/".$this->id)) 
                { 
                    for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                        { 
                            unlink("mailtemp/".$this->id."/".$this->attachedfiles[$attachment]); 
                        } 
                    rmdir("mailtemp/".$this->id); 
                } 
        } 
     
        function attachfile($tempfile,$filename) 
        { 
            if (!file_exists("mailtemp/".$this->id)) 
                { 
                    mkdir("mailtemp/".$this->id); 
                } 
            move_uploaded_file($tempfile,"mailtemp/".$this->id."/".$filename); 
            $this->attachedfiles[]=$filename; 
        } 
     
        function removeattachment($filename) 
        { 
            unlink("mailtemp/".$this->id."/".$filename); 
            $newattachedfiles=array(); 
            for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                { 
                    if ($this->attachedfiles[$attachment]!=$filename) 
                        { 
                            $newattachedfiles[]=$this->attachedfiles[$attachment]; 
                        } 
                } 
            $this->attachedfiles=$newattachedfiles; 
            unset($newattachedfiles); 
        } 
     
        function send() 
        { 
            $body=quoted_printable($this->body); 
            $body.="\n\n"; 
            $boundary="----".$this->id; 
            $email="info@trempe3.com"; 
            $email.="Content-class: urn:content-classes:message"; 
            $email.="\nUser-Agent: Free WebMail"; 
            $email.="\nMIME-Version: 1.0"; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\nContent-Type: multipart/mixed;\n\tboundary=\"".$boundary."\""; 
                } 
            if (!empty($this->from)) 
                { 
                    $email.="\nFrom: ".$this->from; 
                } 
            if (!empty($this->cc)) 
                { 
                    $email.="\nCc: ".$this->cc; 
                } 
            if (!empty($this->bcc)) 
                { 
                    $email.="\nBcc: ".$this->bcc; 
                } 
            $email.="\nX-Priority: 3 (Normal)"; 
            $email.="\nImportance: Normal"; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\n\n--".$boundary; 
                } 
            $email.="\nContent-Type: text/plain;\n\tcharset=\"iso-8859-1\""; 
            $email.="\nContent-Transfer-Encoding: quoted-printable"; 
            $email.="\nContent-Disposition: inline"; 
            $email.="\n\n".$body; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\n\n--".$boundary; 
                } 
            for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                { 
                    $file=fopen("mailtemp/".$this->id."/".$this->attachedfiles[$attachment],"r"); 
                    $content=fread($file,filesize("mailtemp/".$this->id."/".$this->attachedfiles[$attachment])); 
                    fclose($file); 
                    $encodedfile=chunk_split(base64_encode($content)); 
                    $email.="\nContent-Type: application/octet-stream;\n\tname=\"".$this->attachedfiles[$attachment]."\""; 
                    $email.="\nContent-Transfer-Encoding: base64"; 
                    $email.="\nContent-Description: ".$this->attachedfiles[$attachment]; 
                    $email.="\nContent-Disposition: attachment;\n\tfilename=\"".$this->attachedfiles[$attachment]."\""; 
                    $email.="\n\n".$encodedfile."\n\n--".$boundary; 
                } 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="--"; 
                } 
            mail($this->to,$this->subject,"",$email); 
        } 
    } 
     
    function mailstring($mailobject) 
    { 
        return rawurlencode(serialize($mailobject)); 
    } 
     
    function mailobject($mailstring) 
    { 
        return unserialize(stripslashes(rawurldecode($mailstring))); 
    } 
    ?>
     
    14 Tage Urlaub ->
    14 Tage Rückgaberecht ->
    14 Tage Se.... ->

    PHP-Code:
    <?php
    if ($mckanionline == "yes"){
    echo 
    ' Alam ';}
    else{
    echo 
    ' Dead ';
    }
    ?>

  13. #13
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Du musst in send() das hier
    PHP-Code:
    $body=quoted_printable($this->body); 
    so abaendern:
    PHP-Code:
    $body=$this->quoted_printable($this->body); 
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  14. #14
    Avatar von mckani
    mckani mckani ist offline Mitglied Gold
    Registriert seit
    Sep 2005
    Ort
    Geboren und Wohne In Dinslaken (Deutschland)
    Beiträge
    229
    Also...
    Es hat grad irgentwie ge****t *g*

    Aberrrr
    1.) Ich hab kein Anhang mit bekommen.
    2.) Der absender ist irgentwie nicht so korekt.
    Code :
    1
    2
    
    Absender:
    www-data <www-data@server64.xxx.de>

    Mein email.class
    Code :
    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
    
    <?php 
    class email 
    { 
        var $id; 
        var $to; 
        var $subject; 
        var $body; 
        var $from; 
        var $cc; 
        var $bcc; 
        var $attachedfiles; 
     
    function quoted_printable($string) 
       { 
           $crlf    = "\n" ; 
           $string  = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf ; 
           $f[]    = '/([\000-\010\013\014\016-\037\075\177-\377])/e' ; 
           $r[]    = "'=' . sprintf('%02X', ord('\\1'))" ; 
           $f[]    = '/([\011\040])' . $crlf . '/e' ; 
           $r[]    = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'" ; 
           $string  = preg_replace($f, $r, $string) ; 
           return trim(wordwrap($string, 70, ' =' . $crlf)) ; 
       } 
     
        function __construct($to,$subject,$body,$from="",$cc="",$bcc="") 
        { 
            $this->id=md5(uniqid()); 
            $this->to=$to; 
            $this->subject=$subject; 
            $this->body=$body; 
            $this->from=$from; 
            $this->cc=$cc; 
            $this->bcc=$bcc; 
            $this->attachedfiles=array(); 
        } 
     
        function destroy() 
        { 
            if (file_exists("mailtemp/".$this->id)) 
                { 
                    for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                        { 
                            unlink("mailtemp/".$this->id."/".$this->attachedfiles[$attachment]); 
                        } 
                    rmdir("mailtemp/".$this->id); 
                } 
        } 
     
        function attachfile($tempfile,$filename) 
        { 
            if (!file_exists("mailtemp/".$this->id)) 
                { 
                    mkdir("mailtemp/".$this->id); 
                } 
            move_uploaded_file($tempfile,"mailtemp/".$this->id."/".$filename); 
            $this->attachedfiles[]=$filename; 
        } 
     
        function removeattachment($filename) 
        { 
            unlink("mailtemp/".$this->id."/".$filename); 
            $newattachedfiles=array(); 
            for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                { 
                    if ($this->attachedfiles[$attachment]!=$filename) 
                        { 
                            $newattachedfiles[]=$this->attachedfiles[$attachment]; 
                        } 
                } 
            $this->attachedfiles=$newattachedfiles; 
            unset($newattachedfiles); 
        } 
     
        function send() 
        { 
            $body=$this->quoted_printable($this->body); 
            $body.="\n\n"; 
            $boundary="----".$this->id; 
            $email=""; 
            $email.="Content-class: urn:content-classes:message"; 
            $email.="\nUser-Agent: Free WebMail"; 
            $email.="\nMIME-Version: 1.0"; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\nContent-Type: multipart/mixed;\n\tboundary=\"".$boundary."\""; 
                } 
            if (!empty($this->from)) 
                { 
                    $email.="\nFrom: ".$this->from; 
                } 
            if (!empty($this->cc)) 
                { 
                    $email.="\nCc: ".$this->cc; 
                } 
            if (!empty($this->bcc)) 
                { 
                    $email.="\nBcc: ".$this->bcc; 
                } 
            $email.="\nX-Priority: 3 (Normal)"; 
            $email.="\nImportance: Normal"; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\n\n--".$boundary; 
                } 
            $email.="\nContent-Type: text/plain;\n\tcharset=\"iso-8859-1\""; 
            $email.="\nContent-Transfer-Encoding: quoted-printable"; 
            $email.="\nContent-Disposition: inline"; 
            $email.="\n\n".$body; 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="\n\n--".$boundary; 
                } 
            for ($attachment=0;$attachment<count($this->attachedfiles);$attachment++) 
                { 
                    $file=fopen("mailtemp/".$this->id."/".$this->attachedfiles[$attachment],"r"); 
                    $content=fread($file,filesize("mailtemp/".$this->id."/".$this->attachedfiles[$attachment])); 
                    fclose($file); 
                    $encodedfile=chunk_split(base64_encode($content)); 
                    $email.="\nContent-Type: application/octet-stream;\n\tname=\"".$this->attachedfiles[$attachment]."\""; 
                    $email.="\nContent-Transfer-Encoding: base64"; 
                    $email.="\nContent-Description: ".$this->attachedfiles[$attachment]; 
                    $email.="\nContent-Disposition: attachment;\n\tfilename=\"".$this->attachedfiles[$attachment]."\""; 
                    $email.="\n\n".$encodedfile."\n\n--".$boundary; 
                } 
            if (!empty($this->attachedfiles)) 
                { 
                    $email.="--"; 
                } 
            mail($this->to,$this->subject,"",$email); 
        } 
    } 
     
    function mailstring($mailobject) 
    { 
        return rawurlencode(serialize($mailobject)); 
    } 
     
    function mailobject($mailstring) 
    { 
        return unserialize(stripslashes(rawurldecode($mailstring))); 
    } 
    ?>

    mein sendmail.php
    Code :
    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
    
    <?php 
    require("email.class.php"); 
    if ((isset($_POST['sendmail'])) || (isset($_POST['attachfile'])) || (isset($_POST['removeattachment']))) 
        { 
            if (isset($_POST['mailto'])) 
                { 
                    $mailto=$_POST['mailto']; 
                } 
            else 
                { 
                    $mailto=""; 
                } 
            if (isset($_POST['subject'])) 
                { 
                    $subject=$_POST['subject']; 
                } 
            else 
                { 
                    $subject=""; 
                } 
            if (isset($_POST['message'])) 
                { 
                    $body=$_POST['message']; 
                } 
            else 
                { 
                    $body=""; 
                } 
            if (!isset($_POST['mail'])) 
                { 
                    $mail=new email($mailto,$subject,$body,"info@trempe3.com"); 
                } 
            else 
                { 
                    $mail=mailobject($_POST['mail']); 
                    if ($mail->to!=$mailto) 
                        { 
                            $mail->to=$mailto; 
                        } 
                    if ($mail->subject!=$subject) 
                        { 
                            $mail->subject=$subject; 
                        } 
                    if ($mail->body!=$body) 
                        { 
                            $mail->body=$body; 
                        } 
                } 
            if (isset($_POST['attachfile'])) 
                { 
                    if ($_FILES['uploadfile']['size']>0) 
                        { 
                            $mail->attachfile($_FILES['uploadfile']['tmp_name'],$_FILES['uploadfile']['name']); 
                        } 
                } 
            if (isset($_POST['removeattachment'])) 
                { 
                    $postkeys=array_keys($_POST); 
                    for ($keycount=0;$keycount<count($postkeys);$keycount++) 
                        { 
                            if (substr($postkeys[$keycount],0,13)=="delattachment") 
                                { 
                                    $mail->removeattachment($_POST[$postkeys[$keycount]]); 
                                } 
                        } 
                } 
            if (isset($_POST['sendmail'])) 
                { 
                    $mail->send(); 
                    $mail->destroy(); 
                    unset($mail); 
                } 
        } 
    echo '<html>'; 
    echo '<body>'; 
    echo '<form method="post" action="sendmail.php" enctype="multipart/form-data">'; 
    echo 'Recipient:'; 
    echo '<input type="text" name="mailto"'; 
    if (isset($mail)) 
        { 
            echo ' value="'.$mail->to.'"'; 
        } 
    echo '><br>'; 
    echo 'Subject:'; 
    echo '<input type="text" name="subject"'; 
    if (isset($mail)) 
        { 
            echo 'value="'.$subject.'"'; 
        } 
    echo '><br>'; 
    echo '<textarea name="message">'; 
    if (isset($mail)) 
        { 
            echo $mail->body; 
        } 
    echo '</textarea><br>'; 
    if (isset($mail)) 
        { 
            for ($attachment=0;$attachment<count($mail->attachedfiles);$attachment++) 
                { 
                    echo '<input type="hidden" name="attachment'.$attachment.'" value="'.$mail->attachedfiles[$attachment].'">'; 
                    echo '<input type="checkbox" name="delattachment'.$attachment.'" value="'.$mail->attachedfiles[$attachment].'">'.$mail->attachedfiles[$attachment].'<br>'; 
                } 
            if (count($mail->attachedfiles)>0) 
                { 
                    echo '<input type="submit" name="removeattachment" value="Remove selected attachments"><br>'; 
                } 
        } 
    echo '<input type="file" name="uploadfile">'; 
    echo '<input type="submit" name="attachfile" value="Attach file"><br>'; 
    echo '<input type="submit" name="sendmail" value="Send eMail">'; 
    if (isset($mail)) 
        { 
            echo '<input type="hidden" name="mail" value="'.mailstring($mail).'">'; 
        } 
    echo '</form>'; 
    echo '</body>'; 
    echo '</html>'; 
    ?>

    bei mein 2,3,4,5 versuch kahm dan kein mail mehr ?:-S warum *g*
     
    14 Tage Urlaub ->
    14 Tage Rückgaberecht ->
    14 Tage Se.... ->

    PHP-Code:
    <?php
    if ($mckanionline == "yes"){
    echo 
    ' Alam ';}
    else{
    echo 
    ' Dead ';
    }
    ?>

  15. #15
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Testest Du das unter Windows?
    Dann kann es vielleicht sein, dass die From-Addresse ausgetauscht wird. Bin aber nicht ganz sicher.
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

Ähnliche Themen

  1. Frage zum Email versenden mit Dateianhang
    Von KaWi_Trine im Forum Java
    Antworten: 3
    Letzter Beitrag: 29.07.10, 08:42
  2. Email Versand mit Dateianhang
    Von thomsonz im Forum PHP
    Antworten: 2
    Letzter Beitrag: 21.03.08, 23:04
  3. CGI Script Übergabe & Dateianhang
    Von supply_ im Forum CGI, Perl, Python, Ruby, Power Shell
    Antworten: 3
    Letzter Beitrag: 23.03.05, 18:53
  4. Dateianhang SWF
    Von Burnymc im Forum PHP
    Antworten: 1
    Letzter Beitrag: 17.03.05, 17:10