[ MilosOskar @ 20.09.2011. 23:21 ] @
Cao, okacih svoj sajt, napravih formu na kontakt sekciji, ali dalje nemam pojma. Trebao bih da napravim skriptu u php-u da kad posetilac unese podatke i klikne na button posalji, da mail stigne na moj u mail adresu.

Pomagajte, svaka pomoc je dobrodosla.

Od cega da pocnem ? Ili ima negde gotova skripta ?
[ raaddd @ 21.09.2011. 00:23 ] @
PHPmailer je ok, radi posao i jednostavan je za podešavanje, pa probaj.

Treba ti je jedan fajl (phpmailer klasa) i mrva koda na stranici sa koje šalješ podatke ka serveru... Potraži dokumentaciju na njihovom sajtu, imaš i tutorijal na: Products->PHPmailer->Support...

Pozdrav.
[ plus_minus @ 21.09.2011. 00:31 ] @
Ili php mailer ili recimo ovako nešto, možda još prostije. Kako se uzme.

Evo ti komplet skripte sa css-om.
Izmeni u .php fajlu liniju broj 64 po želji, prepravi na željeni email.

Code (php):


<!DOCTYPE html>
<html lang="sr">
<head>
<meta charset="utf-8">
<title>Kontakt</title>  
<link href="form.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="form">
            <?php
                 $error    = ''; // error message
                 $name     = ''; // sender's name
                 $email    = ''; // sender's email address
                 $subject  = ''; // subject
                 $message  = ''; // the message itself
                     $spamcheck = ''; // Spam check

            if(isset($_POST['send']))
            {
                 $name     = $_POST['name'];
                 $email    = $_POST['email'];
                 $subject  = $_POST['subject'];
                 $message  = $_POST['message'];
                     $spamcheck = $_POST['spamcheck'];

                if(trim($name) == '')
                {
                    $error = '<div class="error">Molimo vas, zaboravili ste ime!</div>';
                }
                   else if(trim($email) == '')
                {
                    $error = '<div class="error">Molimo vas, vaša email adresa je neophodna!</div>';
                }
                else if(!isEmail($email))
                {
                    $error = '<div class="error">Email adresa nije lepo upisana. Molimo vas, probajte ponovo!</div>';
                }
                   if(trim($subject) == '')
                {
                    $error = '<div class="error">Ne možete poslati poruku bez naziva teme.</div>';
                }
               else if(trim($message) == '')
                {
                    $error = '<div class="error">Nedostaje tekst u poruci.</div>';
                }
                    else if(trim($spamcheck) == '')
                 {
                    $error = '<div class="error">Molimo vas, unesite tačan broj.</div>';
                 }
                    else if(trim($spamcheck) != '25')
                 {
                    $error = '<div class="error">Anti-bot provera: Broj koji ste uneli nije validan. 10 + 15 = ???</div>';
                 }
                if($error == '')
                {
                    if(get_magic_quotes_gpc())
                    {
                        $message = stripslashes($message);
                    }

                    // the email will be sent here
                    // make sure to change this to be your e-mail
                    $to      = "[email protected]";

                    // the email subject
                    // '[Contact Form] :' will appear automatically in the subject.
                    // You can change it as you want

                    $subject = '[Contact Form] : ' . $subject;

                    // the mail message ( add any additional information if you want )
                    $msg     = "From : $name \r\ne-Mail : $email \r\nSubject : $subject \r\n\n" . "Message : \r\n$message";

                    mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n");
            ?>

<div style="text-align:center;">
<h1>Odlično!</h1>
<p>Hvala vam <b><?=$name;?></b>.
Vaša poruka je poslata!</p>
<p>Odgovorićemo vam u što kraćem periodu.</p>
</div>

<?php
                }
            }

            if(!isset($_POST['send']) || $error != '')
            {
            ?>
<h1>Vaše mišljenje je dragoceno</h1>
<?=$error;?>

<form  method="post" name="contFrm" id="contFrm" action="">
<label><span class="required">*</span> Vaše Ime:</label>
<input name="name" type="text" class="box" id="name" size="50" value="<?=$name;?>" />
<label><span class="required">*</span> Vaš email: </label>
<input name="email" type="text" class="box" id="email" size="50" value="<?=$email;?>" />
<label><span class="required">*</span> Tema: </label>
<input name="subject" type="text" class="box" id="subject" size="50" value="<?=$subject;?>" />
<label><span class="required">*</span> Poruka: </label>
<textarea name="message" cols="60" rows="15"  id="message"><?=$message;?></textarea>
<label><span class="required">*</span> <em>Anti-bot provera:</em> 10+15 = </label>
<input name="spamcheck" type="text" class="box" id="spamcheck" size="4" value="<?=$spamcheck;?>" />
<p style="text-align:center"><input title="send Email" name="send" type="submit" class="button" id="send" value="Pošalji" /></p>
</form>

<?php
            }

            function isEmail($email)
            {
                return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|
bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|
ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|
hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|
ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|
net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|
sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td
|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|
(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i"

                        ,$email));
            }
            ?>

</div>    
</body>
</html>

 



I Css. Naravno, to možeš spakovati u head .php fajla.

Code:


@charset 'utf-8';

html, body {border:0;margin:0;padding:0;}
body {font-family: 'Verdana', 'Geneva', sans-serif;background:white;width:100%;}
h1 {margin:30px auto 50px auto;font-size:200%;text-align:center;}
#form {display:block;font-size:11px;
width:450px;margin:20px auto;
padding:25px;border:none;
box-shadow:0px 0px 20px white;
-moz-box-shadow:0px 0px 20px white;
-webkit-box-shadow:0px 0px 20px white;}
label {display: block;float: left;clear:left;width:170px;line-height:20px;margin-bottom:10px;margin:5px 0;}
input, textarea, select {text-align:left;margin:0;padding:2px;
font-size:1em;color: #666666;background:#F5F5F5;
border:1px solid #ccc;margin:5px 0;
box-shadow:inset 0px -1px 3px #666;
-moz-box-shadow:inset 0px -1px 3px #666;
-webkit-box-shadow:inset 0px -1px 3px #666;}   

input:focus, textarea:focus, select:focus {border: 1px solid #999;background:#white;
box-shadow:inset 0px 1px 4px black;-moz-box-shadow:inset 0px 1px 4px black;-webkit-box-shadow:inset 0px 1px 4px black;}
input.button {font-size:15px;cursor: pointer;padding:5px;text-shadow:0px 0px 1px green;width:auto;height:auto;}
span.required{font-size: 10px !important;width: auto;color: green !important;}
.error {display:block;width:auto;height:auto;line-height:25px;color:#FFFFFF;font-weight:bold;
background:#FF9D9D;text-align:center;padding:5px;margin:10px 0;border:1px solid black;}
.msgSent {font-size: 20px;text-align: center;}

[ ivan veljovic @ 05.10.2011. 20:05 ] @
pretpostavljam da su ti gornja rešenja nejasna ako si početnik pa ti predlažem da
pogledaš PHP-ovu funkciju mail()

evo ti i prost primer:

<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

kada ovo razjasniš kako radi onda pogledaj i ostale predloge...