Thursday, 2024-04-25, 0:34 AM
Main
Registration
Login
RaDIo^^ZoNe
Welcome Guest | RSS
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » TUTORIAL ZONE » Diferite tutoriale » email send script
email send script
radio-zoneDate: Thursday, 2008-08-14, 3:16 PM | Message # 1
Admin
Group: Administrators
Messages: 11
Reputation: 0
Status: Offline
E-mail sender script

Trebuie sa faci urmatoarele pagini:

Code

contact.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contactati-ne !</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body ><form action="trimitere.php">
<p>nume :
   <input name="" type="text">
</p>
<p>email :
   <input name="Input" type="text">
</p>
<p>mesaj :
   <textarea name="textarea"></textarea>
</p>
<p>
   <input type="submit" name="Submit" value="Submit">
   <input type="reset" name="reset" value="reset">
</p>
</form></body>
</html>



Code
eroare.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Eroare!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
Va rugam sa introduceti toate datele corect!
</body>
</html>
</body>
</html>



Code

multumim.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Multumim!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
Va multumim pentru ca folositi serviciile noastre!
</body>
</html>
</body>
</html>

Code
trimitere.php:
<?
require_once ("smtp.php");
// ---------------------- SECTIUNE CONFIGURABILA ------------------------

// $mailto= "user@xhost.ro";
$mailto = "*****@inmail24.com";

// Date autentificare SMTP
$smtserver = "smtp.inmail24.com";
$smtpuser = "******@inmail24.com";
$smtppass = "parola_ta";

//Subiectul mesajului
$subiect = "subiectul_mailului" ;

//Paginile afisate

//$formurl = "contact.html" ;
//$errorurl = "eroare.html" ;
//$thankyouurl = "multumim.html" ;

$formurl = index.htm" ;
$errorurl = "eroare.html" ;
$thankyouurl = "multumim.html" ;

// -------------------- SFARSITUL SECTIUNII CONFIGURABILE ---------------

$nume = $_POST['nume'] ;

//Verifica daca este scris numele
if($nume==""){
exit("Va rugam sa va scrieti numele si prenumele");
}

$prenume = $_POST['prenume'] ;

if($prenume==""){
exit("Va rugam sa scrieti cui ii este adresat mesajul (oana sau ilink)");
}

$email = $_POST['email'] ;

//Verifica daca adresa de email este valida
function validate_email($email) {
if (preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $email)) {return true;}
else {return false;}
}
if (validate_email($email) == false){exit("Eroare! Va rugam sa scrieti o adresa de email valida");}

$mesaj = $_POST['mesaj'] ;

//Verifica daca este scris mesajul
if($mesaj==""){
exit("Va rugam scrieti mesajul altfel el nu va fi trimimis");
}

$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($nume) || empty($email) || empty($mesaj)) {
header( "Location: $errorurl" );
exit ;
}
$nume = strtok( $nume, "\r\n" );
$prenume = strtok( $prenume, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
$mesaj = stripslashes( $mesaj );
}
$body ="Nume: $nume\n\n";
$body .="Prenume: $prenume\n\n";
$body .="Email: $email\n\n";
$body .="Mesaj: $mesaj\n\n";

smtpmail($smtserver, 25, $smtpuser, $smtppass, $email, $mailto, $subiect, $body, $headers);
header( "Location: $thankyouurl" );
exit ;

?>



[hr]
 
Forum » TUTORIAL ZONE » Diferite tutoriale » email send script
  • Page 1 of 1
  • 1
Search:


| Copyright MyCorp © 2024 | |