Mail form with attachments
Posted: Fri Dec 15, 2006 9:23 am
Burrito | Please use
Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have form and I made that it sends to my e-mail but I have big problem - how can I make that it sends attached image files? Maybe someone can really help me =] I am really just beginner (file field name is - "files" and there can be added 4 files) Here is the script:Code: Select all
<?php
$mailto = 'my-email' ;
$subject = "Pasūtījums" ;
$uself = 0;
// -------------------- Konfiguracijas beigas ---------------
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$phone = $_POST['phone'] ;
$email = $_POST['email'] ;
$age = $_POST['age'] ;
$website = $_POST['website'] ;
$bio = $_POST['bio'] ;
$files = $_POST['files'] ;
$http_referrer = getenv( "HTTP_REFERER" );
$message =
"Šī ziņa tika nosūtīta no:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Vārds: $name\n" .
"Uzvārds: $uzvards\n" .
"E-Pasts: $email\n" .
"Kontakttālrunis: $talrunis\n" .
"Vecums: $age\n" .
"------------------------- Komentāri -------------------------\n\n" .
"\n\n------------------------------------------------------------\n" ;
if (empty($name) || empty($phone) || empty($age)) {
echo 'Lūdzu ievadiet visus datus.';
}
else
if (isset($name) || isset($phone) || isset($age)) {
echo 'Paldies. Ziņojums tika nosūtīts.';
mail($mailto, $subject, $message,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "Pasūtījums");
exit; }
?>Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]