[PHP] Attachment via mail()

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Ik weet dat ik de zoveelste ben die een topic hierover opent, maar ik kan echt niet ontdekken waarom ik met mijn code niet een e-mail tekst kan meesturen. De attachment werkt prima, maar de rest van de e-mail lukt me niet. Ik heb de code grotendeels zelf geschreven, maar een paar kleine stukjes zijn door anderen gedaan.

PHP:
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
        // message stuff
            $subj = "Uw abonnement is geactiveerd";
            $mailman = "ya-right";
            $send_date = date("r",time());
            $bdate = time();
            $bound = "000-".$mailman."-".$bdate."";
        // email stuff
            $from_mail = "info@bibite.nl";
            $from_real = "Bibite.nl";
            $to_mail = $list->email;
            $to_real = $list->naam;
        // attachment stuff
            $fattach = "leden/admin/factuur.html";
            $fl = $_SERVER[DOCUMENT_ROOT];
            $send .= "From: \"".$from_real."\" <".$from_mail.">\n";
            $send .= "To: \"".$to_real."\" <".$to_mail.">\n";
        //  $send .= "X-Priority: 1 (High)\n";
            $send .= "X-Mailer: <My Mail Server>\n";
            $send .= "MIME-Version: 1.0\n";
            $send .= "Content-Type: multipart/mixed; boundary=\"$bound\"\n\n";
            $end .= "This is a multi-part message in mime format\n\n";
            $end .= "--".$bound."\n";
            $end .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
            $end .= "Content-Transfer-Encoding: 8bit;\n\n";
            $end .= "".preg_replace("/\r\n/i", "\n", $msg)."\n\n";
            $end .= "--".$bound."\n";
            $end .= "Content-Type: application/octet-stream\n";
            $end .= "Content-Transfer-Encoding: base64\n";
            $end .= "Content-Disposition: attachment; filename=\"factuur.html\"\n\n";
            set_magic_quotes_runtime(0);
            $attachment = fread(fopen("$fl/$fattach", "rb"), filesize("$fl/$fattach"));
            $attachment = chunk_split(base64_encode($attachment));
            $attachment = preg_replace("/\r\n/i", "\n", $attachment);
            $end .= "$attachment";
            $end .= "\n";
            $end .= "--".$bound."--\n\n";
        // send the mail
            mail($list->email, $subj, $end . "Dit is de e-mail", $send);


dus nogmaals: waardoor kan ik niet gewoon een e-mailtje sturen, maar alleen de attachment.

Acties:
  • 0 Henk 'm!

  • crisp
  • Registratie: Februari 2000
  • Laatst online: 16:12

crisp

Devver

Pixelated

verkeerde forum... W&G --> P&W

Intentionally left blank


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Oeps, sorry had even mijn hoofd er niet bij.