Prova1ver Posted April 15, 2013 Report Share Posted April 15, 2013 Labdien, Sāku taisīt projektu uz twitter bootstrap bāzes, vēlējos vienā no sadaļām izveidot contact us formu , kas pēc lietotāja formu aizpildes aizsūtīs datuus uz manu epasta adresi izmantojot gmail smtp. varbūt jau ir gatavs skripts, meklēju google atradu dažus , bet varbūt jūs kādu varat ieteikt. Paldies. Quote Link to comment Share on other sites More sharing options...
F3llony Posted April 15, 2013 Report Share Posted April 15, 2013 http://swiftmailer.org/ Quote Link to comment Share on other sites More sharing options...
Prova1ver Posted April 16, 2013 Author Report Share Posted April 16, 2013 Izveidoju contact.html formu kas savienojas ar contact-form-submission.php, bet man kaut k'a neiet varb'ut k'ads var izpalīdzēt izlabot kļūdu. Paldies contact.html <!DOCTYPE HTML> <html> <head> <title>My basic contact form</title> <link href="css/bootstrap.min.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="page-header"> <h1>Contact Me</h1> </div> <?php // check for a successful form post if (isset($_GET['s'])) echo "<div class=\"alert alert-success\">".$_GET['s']."</div>"; // check for a form error elseif (isset($_GET['e'])) echo "<div class=\"alert alert-error\">".$_GET['e']."</div>"; ?> <form method="POST" action="contact-form-submission.php" class="form-horizontal"> <div class="control-group"> <label class="control-label" for="input1">Name</label> <div class="controls"> <input type="text" name="contact_name" id="input1" placeholder="Your name"> </div> </div> <div class="control-group"> <label class="control-label" for="input2">Email Address</label> <div class="controls"> <input type="text" name="contact_email" id="input2" placeholder="Your email address"> </div> </div> <div class="control-group"> <label class="control-label" for="input3">Message</label> <div class="controls"> <textarea name="contact_message" id="input3" rows="8" class="span5" placeholder="The message you want to send to me."></textarea> </div> </div> <div class="form-actions"> <input type="hidden" name="save" value="contact"> <button type="submit" class="btn btn-primary">Send</button> </div> </form> </div> </body> </html> contact-form-submission.php <?php // check for form submission - if it doesn't exist then send back to contact form if (!isset($_POST['save']) || $_POST['save'] != 'contact') { header('Location: contact-form.php'); exit; } // get the posted data $name = $_POST['contact_name']; $email_address = $_POST['contact_email']; $message = $_POST['contact_message']; // check that a name was entered if (empty($name)) $error = 'You must enter your name.'; // check that an email address was entered elseif (empty($email_address)) $error = 'You must enter your email address.'; // check for a valid email address elseif (!preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', $email_address)) $error = 'You must enter a valid email address.'; // check that a message was entered elseif (empty($message)) $error = 'You must enter a message.'; // check if an error was found - if there was, send the user back to the form if (isset($error)) { header('Location: contact-form.php?e='.urlencode($error)); exit; } // write the email content $email_content = "Name: $name\n"; $email_content .= "Email Address: $email_address\n"; $email_content .= "Message:\n\n$message"; // send the email mail ("mas@mans.lv", "Epasta Title", $email_content); // send the user back to the form header('Location: contact-form.php?s='.urlencode('Thank you for your message.')); exit; ?> Quote Link to comment Share on other sites More sharing options...
404 Posted April 16, 2013 Report Share Posted April 16, 2013 (edited) Izmantot mail() nebūs ne labais tonis ne arī prāta darbs. Izmanto klasisko PHPMailer (worxware): http://phpmailer.worxware.com/ Edited April 16, 2013 by 404 Quote Link to comment Share on other sites More sharing options...
Prova1ver Posted April 16, 2013 Author Report Share Posted April 16, 2013 (edited) to funkciju augstakais izmantos 3-4 x vispar, negribas iedzilināties phpmailera un meiginat to savienot ar bootstrap. Projekts nav nopietns uz šo momentu mail funkcija ir tas kas vajadzigs. kļudu vienalga neesmu sapratis Edited April 16, 2013 by Prova1ver Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted April 17, 2013 Report Share Posted April 17, 2013 Ir norādīts/nokonfigurēts SMTP caur kuru sūtīt? Quote Link to comment Share on other sites More sharing options...
Kavacky Posted April 17, 2013 Report Share Posted April 17, 2013 to funkciju augstakais izmantos 3-4 x vispar, negribas iedzilināties phpmailera un meiginat to savienot ar bootstrap.Nav jau tur nekā tik daudz, lai vajadzētu baigi iedziļināties, ja vajag prastu meilu nosūtīt. Quote Link to comment Share on other sites More sharing options...
ieleja Posted April 17, 2013 Report Share Posted April 17, 2013 paņem no tā .php faila to rindiņu, kur tiek izsaukts mail() saliec visur gatavas, reālas vērtības un izpildi ja nestrādā, tad sistēmā nestrādā mail() ja strādā, tad liec klāt savas mežģīnes pa vienai un skaties tālāk Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted April 18, 2013 Report Share Posted April 18, 2013 phpmailer vairs netiek atbalstits? Quote Link to comment Share on other sites More sharing options...
daGrevis Posted April 18, 2013 Report Share Posted April 18, 2013 Kas par sviestu... cilvēks prasa kā STD-liba funkciju padarīt strādājošu, bet jūs viņam metat sejā kkkādas abstrakcijas... > — Hei, kā lai stringā ieliek mainīgā vērtību? > — Izmanto Smarty! Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted April 18, 2013 Report Share Posted April 18, 2013 daGrevis Quote Link to comment Share on other sites More sharing options...
daGrevis Posted April 19, 2013 Report Share Posted April 19, 2013 Vai ne? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.