Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> zalaczniki w mailach
maggot
post
Post #1





Grupa: Zarejestrowani
Postów: 77
Pomógł: 0
Dołączył: 7.05.2002
Skąd: Sz-n/Wroc/Wawa

Ostrzeżenie: (0%)
-----


Jak zrobic zeby wyslac maila z zalacznikiem z dysku lokanego internauty (np podaje on plik c:bleee.ble - i jest on wysylany do mnie przez maila jako zalacznik) ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dvc
post
Post #2





Grupa: Zarejestrowani
Postów: 139
Pomógł: 0
Dołączył: 29.04.2002
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


już na ten temat była mowa na forum
za pomocą funkcji mail()
tworzysz najpierw formularz:
index.php3:

Kod
<FORM ACTION="send.php3" METHOD="POST" ENCTYPE="multipart/form-data">

// ten input poniżej służy do tego aby ograniczyć wielkość przesyłki

<input type="hidden" name="MAX_FILE_SIZE" value="4096">

<input type="text" name="from" VALUE="MAGGOT">

<input type="text" name="temat">

<input type="file" name="attach">

<textarea cols=55 rows=10 name="tresc" wrap="message"></textarea>

<input type="submit" value="Wyślij" name="mail">

<input type="reset" value="Wyczyść">

</FORM>


send.php3:

Kod
<?php

$mailheaders = "From: $fromn";

$mailheaders .= "Reply-To: $fromn";

$mailheaders .= "Cc: $ccn";

$mailheaders .= "X-Mailer: Server Web Email Interfacen";

$msg_body = stripslashes($body);

if ($attach != "none")

{

$file = fopen($attach, "r");

$contents = fread($file, $attach_size);

$encoded_attach = chunk_split(base64_encode($contents));

fclose($file);

$mailheaders .= "MIME-version: 1.0n";

$mailheaders .= "Content-type: multipart/mixed; ";

$mailheaders .= "boundary="Message-Boundary"n";

$mailheaders .= "Content-transfer-encoding: 7BITn";

$mailheaders .= "X-attachments: $attach_name";

$body_top = "--Message-Boundaryn";

$body_top .= "Content-type: text/plain; charset=US-ASCIIn";

$body_top .= "Content-transfer-encoding: 7BITn";

$body_top .= "Content-description: Mail message bodynn";

$msg_body = $body_top . $msg_body;

$msg_body .= "nn--Message-Boundaryn";

$msg_body .= "Content-type: $attach_type; name="$attach_name"n";

$msg_body .= "Content-Transfer-Encoding: BASE64n";

$msg_body .= "Content-disposition: attachment; filename="$attach_name"nn";

$msg_body .= "$encoded_attachn";

$msg_body .= "--Message-Boundary--n";

}

mail($to, stripslashes($subject), $msg_body, $mailheaders);

pritn("Mail został wysłany");

?>


zapomiałem dopisać kilk arzeczy a mianowicie, że musisz sobie dokładnie presledzić zmenne, bo ja to powycinałem od siebie ze skryptów
i musiałem sporo usunąć, bo mam to wykorzystane na firmowe potrzeby
Kod
$tresc       = $text

$to          = $mail;

$subject     = $temat;

$body        = $tresc;

$mailheaders = $od;
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 22:28