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;