PHP - Php Form Mailer + Securimage
Hello all! First post.
Wondering if anyone could help me out with a problem I've been having with a form mailer... I had it working at one point in time, but now not so much. I'm using Securimage as a captcha The file is email.php My problem is... When you type in the code wrong, it tells you its wrong. When you type the code right, it redirects to thank.html, which is correct...but never sends the mail! Am I missing something obvious? Here's my code: Code: [Select] <?php session_start(); //include_once $_SERVER['DOCUMENT_ROOT'] . '/coaxicom_email_original/securimage/securimage.php'; include_once('securimage/securimage.php'); $securimage = new Securimage(); if( isset($_POST['submit'])) { if ($securimage->check($_POST['captcha_code']) == false) { // the code was incorrect // you should handle the error so that the form processor doesn't continue // or you can use the following code if there is no validation or you do not know how echo "The security code entered was incorrect.<br /><br />"; echo "<a href='email.php'>Please click this link to back and try again.</a>"; exit; } //Data $contact1 = $_POST['contact1']; $company1 = $_POST['company1']; $email1 = $_POST['email1']; $phone1 = $_POST['phone1']; $country1 = $_Post['country1']; $address1 = $_POST['address1']; $city1 = $_POST['city1']; $state1 = $_POST['state1']; $zip1 = $_POST['zip1']; $contact2 = $_POST['contact2']; $company2 = $_POST['company2']; $email2 = $_POST['email2']; $phone2 = $_POST['phone2']; $country2 = $_Post['country2']; $address2 = $_POST['address2']; $city2 = $_POST['city2']; $state2 = $_POST['state2']; $zip2 = $_POST['zip2']; $contact3 = $_POST['contact3']; $company3 = $_POST['company3']; $email3 = $_POST['email3']; $phone3 = $_POST['phone3']; $country3 = $_Post['country3']; $address3 = $_POST['address3']; $city3 = $_POST['city3']; $state3 = $_POST['state3']; $zip3 = $_POST['zip3']; $contact4 = $_POST['contact4']; $company4 = $_POST['company4']; $email4 = $_POST['email4']; $phone4 = $_POST['phone4']; $country4 = $_Post['country4']; $address4 = $_POST['address4']; $city4 = $_POST['city4']; $state4 = $_POST['state4']; $zip4 = $_POST['zip4']; $contact5 = $_POST['contact5']; $company5 = $_POST['company5']; $email5 = $_POST['email5']; $phone5 = $_POST['phone5']; $country5 = $_Post['country5']; $address5 = $_POST['address5']; $city5 = $_POST['city5']; $state5 = $_POST['state5']; $zip5 = $_POST['zip5']; $contact6 = $_POST['contact6']; $company6 = $_POST['company6']; $email6 = $_POST['email6']; $phone6 = $_POST['phone6']; $country6 = $_Post['country6']; $address6 = $_POST['address6']; $city6 = $_POST['city6']; $state6 = $_POST['state6']; $zip6 = $_POST['zip6']; $contact7 = $_POST['contact7']; $company7 = $_POST['company7']; $email7 = $_POST['email7']; $phone7 = $_POST['phone7']; $country7 = $_Post['country7']; $address7 = $_POST['address7']; $city7 = $_POST['city7']; $state7 = $_POST['state7']; $zip7 = $_POST['zip7']; $contact8 = $_POST['contact8']; $company8 = $_POST['company8']; $email8 = $_POST['email8']; $phone8 = $_POST['phone8']; $country8 = $_Post['country8']; $address8 = $_POST['address8']; $city8 = $_POST['city8']; $state8 = $_POST['state8']; $zip8 = $_POST['zip8']; $body = <<<EOD <br /><hr><br /> Company: $company1 <br /> Contact: $contact1 <br /> Email: $email1 <br /> Phone: $phone1 <br /> Country: $country1 <br /> Address: $address1 <br /> City: $city1 <br /> State: $state1 <br /> Zip: $zip1 <br /> <br /><hr><br /> Company: $company2 <br /> Contact: $contact2 <br /> Email: $email2 <br /> Phone: $phone2 <br /> Country: $country2 <br /> Address: $address2 <br /> City: $city2 <br /> State: $state2 <br /> Zip: $zip2 <br /> <br /><hr><br /> Company: $company3 <br /> Contact: $contact3 <br /> Email: $email3 <br /> Phone: $phone3 <br /> Country: $country3 <br /> Address: $address3 <br /> City: $city3 <br /> State: $state3 <br /> Zip: $zip3 <br /> <br /><hr><br /> Company: $company4 <br /> Contact: $contact4 <br /> Email: $email4 <br /> Phone: $phone4 <br /> Country: $country4 <br /> Address: $address4 <br /> City: $city4 <br /> State: $state4 <br /> Zip: $zip4 <br /> <br /><hr><br /> Company: $company5 <br /> Contact: $contact5 <br /> Email: $email5 <br /> Phone: $phone5 <br /> Country: $country5 <br /> Address: $address5 <br /> City: $city5 <br /> State: $state5 <br /> Zip: $zip5 <br /> <br /><hr><br /> Company: $company6 <br /> Contact: $contact6 <br /> Email: $email6 <br /> Phone: $phone6 <br /> Country: $country6 <br /> Address: $address6 <br /> City: $city6 <br /> State: $state6 <br /> Zip: $zip6 <br /> <br /><hr><br /> Company: $company7 <br /> Contact: $contact7 <br /> Email: $email7 <br /> Phone: $phone7 <br /> Country: $country7 <br /> Address: $address7 <br /> City: $city7 <br /> State: $state7 <br /> Zip: $zip7 <br /> <br /><hr><br /> Company: $company8 <br /> Contact: $contact8 <br /> Email: $email8 <br /> Phone: $phone8 <br /> Country: $country8 <br /> Address: $address8 <br /> City: $city8 <br /> State: $state8 <br /> Zip: $zip8 <br /> <br /><hr><br /> EOD; //Subject and Email $emailSubject = 'This is my subject'; $webMaster = 'example@gmail.com'; $headers = "From: Example\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster,$emailSubject,$body,$headers); header( "Location: thank.html" ); } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <div id="wrapper"> <div id="main"> <div id="fContainer"> <form action="email.php" method="post" > <div class="fbox" id="f1"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact1" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country1" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address1" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city1" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state1" /></div></div> <br /> <!-- end #f1 --></div> <div class="fbox" id="f2"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact2" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country2" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address2" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city2" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state2" /></div></div> <br /> <!-- end #f2 --></div> <div class="fbox" id="f3"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact3" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country3" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address3" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city3" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state3" /></div></div> <br /> <!-- end #f3 --></div> <div class="fbox" id="f4"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact4" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country4" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address4" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city4" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state4" /></div></div> <br /> <!-- end #f4 --></div> <div class="fbox" id="f5"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact5" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country5" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address5" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city5" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state5" /></div></div> <br /> <!-- end #f5 --></div> <div class="fbox" id="f6"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact6" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country6" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address6" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city6" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state6" /></div></div> <br /> <!-- end #f6 --></div> <div class="fbox" id="f7"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact7" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country7" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address7" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city7" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state7" /></div></div> <br /> <!-- end #f7 --></div> <div class="fbox" id="f8"> <div class="fLine"><div class="fLabel">Company Name:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="company8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Contact:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="contact8" /></div></div> <br /> <div class="fLine"><div class="fLabel">E-mail:</div> <div class="fInput"><input type="text" size="25" maxlength="150" name="email8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Phone:</div> <div class="fInput"><input type="text" size="15" maxlength="50" name="phone8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Country:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="country8" /></div></div> <br /> <div class="fLine"><div class="fLabel">Address:</div> <div class="fInput"><input type="text" size="20" maxlength="300" name="address8" /></div></div> <br /> <div class="fLine"><div class="fLabel">City:</div> <div class="fInput"><input type="text" size="18" maxlength="100" name="city8" /></div></div> <br /> <div class="fLine"><div class="fLabel">State:</div> <div class="fInput"><input type="text" size="10" maxlength="100" name="state8" /></div></div> <br /> <!-- end #f8 --></div> <div id="fCaptcha"> <div id="codeLabel">Security Code<span class="red">*</span>:</div> <div id="img"><img id="captcha" src="securimage/securimage_show.php" alt="CAPTCHA Image" /></div> <div id="text"> <input type="text" name="captcha_code" size="10" maxlength="6" /></div> <!-- end #fCaptcha --></div> <div id="fCaptchaBox"></div> <div id="fSubmit"><input type="submit" name="submit" value="Email This Form" /></div> </form> <!-- end #fContainer --></div> <!-- end #main --></div> <!-- end #wrapper --></div> </body> </html> <?php } ?> Similar TutorialsThis topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357935.0 Hi guyz. I need to create a Booking System using form. same like this: https://www.theorytest.net/book-your-theory-test.php Information will be sent to Email. I know the form creation and sending to Email as well! But i this form is divided into pages how can i collect information that will be available to send through email at the end. (when user will complete this booking) Waiting for your reply Thanks Hi guys, I'm new to this forum, I need some help with a contact form, I've done ones before.. but I need someone to make me a mailer.php file that would suffice this framework for my html coded form. The form also has css, which I can't give out, but I'm sure you coders don't really need to see the form. Basically I would also want this progress bar to work correctly. I can't see to get it all right. Code: [Select] <div id="maincontent"> <h2>Contact</h2> <div id="main_form"> <p id="loadBar" style="display:none;"> <strong>Sending Email. Hold on just a sec…</strong><br /> <img src="images/loading.gif" alt="Loading..." title="Sending Email" /> </p> <p id="emailSuccess" style="display:none;"> <strong style="color:red;">Success! Your Email has been sent.</strong> </p> <div id="contactFormArea"> <form action="mailer.php" method="post" id="cForm"> <fieldset> <label for="posName">Name:</label> <input class="input-textarea" type="text" size="25" name="posName" id="posName" /><br /><br /> <label for="posEmail">Email:</label> <input class="input-textarea" type="text" size="25" name="posEmail" id="posEmail" /><br /><br /> <label for="posRegard">Subject:</label> <input class="input-textarea" type="text" size="25" name="posRegard" id="posRegard" /><br /><br /> <label for="posText">Message:</label> <textarea cols="50" rows="5" name="posText" id="posText"></textarea><br /><br /> <label for="selfCC"> <!--<input type="checkbox" name="selfCC" id="selfCC" value="send" /> Send CC to self--> <input type="hidden" name="selfCC" id="selfCC" value="xxx" /> </label> <label> <input class="input-submit" type="submit" name="sendContactEmail" id="sendContactEmail" value=" Send Email " /> </label> </fieldset> </form> </div> </div> Thanks in advance, Andy I'd truly appreciate any help you can give me with the following PHP form mailer. I get the following error: Parse error: syntax error, unexpected T_ELSE in testcontact.php on line 31 Any ideas on how to fix the error? Also, I need to sanitize the data, but I don't understand how to. Everything I've googled doesn't seem to work. Code: [Select] <?php $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $mailinglist = $_POST['mailinglist']; $companyname = $_POST['companyname']; $address = $_POST['address']; $city = $_POST['city']; $zip = $_POST['zip']; $countrycode = $_POST['countrycode']; $areacode = $_POST['areacode']; $citycode = $_POST['citycode']; $number = $_POST['number']; $fcountrycode = $_POST['fcountrycode']; $fareacode = $_POST['fareacode']; $fcitycode = $_POST['fcitycode']; $fnumber = $_POST['fnumber']; $industry = $_POST['industry']; $product = $_POST['product']; $productnumber = $_POST['productnumber']; $comments = $_POST['comments']; if ($mailinglist != yes) $mailinglist = no; $mail_to = 'example@isp.com'; $subject = 'Webform Data'; $body = "First Name: $firstname \n Last Name: $lastname: \n Email: $email \n Mailing List: $mailinglist \n Company Name: $companyname \n Address: $address \n City: $city \n Zip: $zip \n Phone: $countrycode $areacode $citycode $number \n Fax: $fcountrycode $fareacode $fcitycode $fnumber \n Industry: $industry \n Product: $product \n Number of Packaged Products: $productnumber \n Comments/Questions: $commments "; if (isset($_POST['Submit'])) { mail($to, $subject, $body); echo "You will be contacted shortly."; }; ?> <!DOCTYPE html PUBLIC "/W3C/DTD XHTML 1.0 Transitional/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="main.css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Contact Us</title> </head> <form action="testcontact.php" method="post">* represents required field<br /> *First Name:<input name="firstname" type="text" maxlength="50" value="<?php echo $_POST['firstname']; ?>" /><br /> *Last Name:<input name="lastname" type="text" maxlength="50" value="<?php echo $_POST['lastname']; ?>" /><br /> *E-mail:<input name="email" type="text" maxlength="50" value="<?php echo $_POST['email']; ?>" /><br /> Join Mailing List(check if yes):<input name="mailinglist" type="checkbox" value="<?php echo $_POST['mailinglist']; ?>"/><br /> Company Name:<input name="companyname" type="text" maxlength="100" value="<?php echo $_POST['companyname']; ?>" /><br /> Address:<input name="address" type="text" maxlength="100" value="<?php echo $_POST['address']; ?>" /><br /> City:<input name="city" type="text" maxlength="100" value="<?php echo $_POST['city']; ?>" /><br /> Zip<input name="zip" type="text" maxlength="10" value="<?php echo $_POST['zip']; ?>" /><br /> Phone Number:<input name="countrycode" type="text" size="3" maxlength="3" value="<?php echo $_POST['countrycode']; ?>" />-<input name="areacode" type="text" size="3" maxlength="3" value="<?php echo $_POST['areacode']; ?>" />-<input name="citycode" type="text" size="3" maxlength="3" value="<?php echo $_POST['citycode']; ?>" />-<input name="number" type="text" size="4" maxlength="4" value="<?php echo $_POST['number']; ?>" /><br /> Fax:<input name="fcountrycode" type="text" size="3" maxlength="3" value="<?php echo $_POST['fcountrycode']; ?>" />-<input name="fareacode" type="text" size="3" maxlength="3" value="<?php echo $_POST['fareacode']; ?>" />-<input name="fcitycode" type="text" size="3" maxlength="3" value="<?php echo $_POST['fcitycode']; ?>" />-<input name="fnumber" type="text" size="4" maxlength="4" value="<?php echo $_POST['fnumber']; ?>" /><br /> Industry:<input name="industry" type="text" maxlength="50" value="<?php echo $_POST['industry']; ?>" /><br /> Product Packaged:<input name="product" type="text" maxlength="100" value="<?php echo $_POST['product']; ?>" /><br /> Number of Packaged Products:<input name="productnumber" type="text" maxlength="100" value="productnumber" /><br /> Comments/Questions:<br /><textarea name="comments" rows="5" cols="50" maxlength="10000"><?php echo $_POST['comments']; ?></textarea><br /> <input type="submit" value="submit" /> </form> </body> </html> Thanks! I am attempting to build a SMTP contact form however when my form is submitted i get an error message from google that says my account has been accessed. Also will this work fine with JS form validation? Thank you in advance.
<?php if(isset($_POST['submit'])) { $message= 'Full Name: '.$_POST['fullname'].'<br /> Email: '.$_POST['emailid'].'<br /> Comments: '.$_POST['comments'].' '; require "PHPMailer-master/class.phpmailer.php"; //include phpmailer class // Instantiate Class $mail = new PHPMailer(); // Set up SMTP $mail->IsSMTP(); // Sets up a SMTP connection $mail->SMTPAuth = true; // Connection with the SMTP does require authorization $mail->SMTPSecure = "ssl"; // Connect using a TLS connection $mail->Host = "smtp.gmail.com"; //Gmail SMTP server address $mail->Port = 465; //Gmail SMTP port $mail->Encoding = '7bit'; // Authentication $mail->Username = "me@gmail.com"; //Gmail address $mail->Password = "pass"; // Gmail password // Compose $mail->SetFrom($_POST['emailid'], $_POST['fullname']); $mail->AddReplyTo($_POST['emailid'], $_POST['fullname']); $mail->Subject = "New Contact Form Enquiry"; // Subject $mail->MsgHTML($message); // Send To $mail->AddAddress("me@gmail.com", "Mr. Example"); // Where to send it - Recipient $result = $mail->Send(); // Send! unset($mail); } ?> hi, I'm a newb. barely getting my feet wet in php after years of wanting to. I wrote this script following a youtube tutorial and it all made sense as I coded it.... so as far as I'm familiar with the little bit of coding, my script should work. actually it works. I get an email but with no data??? I can't get the script to gather the info and send it along with the email. not sure why as all seems in place.any help here would be greatly appreciated. thank you. here is the script... <?php /*subject and email variables */ $emailSubject = 'edson vehicle order form'; $webMaster = 'order@edsonvehicleremarketing.com'; /*gathering data variables*/ $modelyear = $_POST['modelyear']; $vehiclemake = $_POST['vehiclemake']; $vehiclemodel = $_POST['vehiclemodel']; $colors = $_POST['colors']; $notcolors = $_POST['notcolors']; $options = $_POST['options']; $descriptions = $_POST['descriptions']; $tradeinyear = $_POST['tradeinyear']; $tradeinmake = $_POST['tradeinmake']; $tradeinmodel = $_POST['tradeinmodel']; $miles = $_POST['miles']; $tradeincolor = $_POST['tradeincolor']; $conditionofcar = $_POST['conditionofcar']; $damage = $_POST['damage']; $lienholder = $_POST['lienholder']; $name = $_POST['name']; $homephone = $_POST['homephone']; $workphone = $_POST['workphone']; $cellphone = $_POST['cellphone']; $besttimetoreach = $_POST['besttimetoreach']; $bestwaytocontact = $_POST['bestwaytocontact']; $paymenttype = $_POST['paymenttype']; $howdidyoulocateus = $_POST['howdidyoulocateus']; $pickuptime = $_POST['pickuptime']; $comments = $_POST['comments']; $body - <<<EOD <br><hr><br> Model year: $modelyear <br> Vehicle make: $vehiclemake <br> Vehicle model: $vehiclemodel <br> Vehicle colors: $colors <br> Colors not considered: $notcolors <br> Options desired: $options <br> Descriptions: $descriptions <br> Trade in year: $tradeinyear <br> Trade in make: $tradeinmake <br> Trade in model: $tradeinmodel <br> miles: $miles <br> Trade in color: $tradeincolor <br> Condition of car: $conditionofcar <br> Damage: $damage <br> Lienholder: $lienholder <br> Name: $name <br> Home phone: $homephone <br> Work phone: $workphone <br> Cell phone: $cellphone <br> Best time to reach: $besttimetoreach <br> Best way to contact: $bestwaytocontact <br> Payment type: $paymenttype <br> How did you locate us: $howdidyoulocateus <br> Pick up time: $pickuptime <br> Comments: $comments <br> EOD; $headers = "From $name\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headrers); /* results rendered as html */ $theResults = <<<EOD <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Edson Vehicle Remarketing</title> <style type="text/css"> body { background-color: #000; background-image: url(); background-repeat: repeat-x; margin-bottom: 0px; } .orderform { left: auto; right: auto; margin-top: 25px; } #htmlforphp { width: auto; height: 300px; text-align: center; padding-top: 250px; padding-right: 50px; font-size: 20px; } </style> <link href="css/layout.css" rel="stylesheet" type="text/css" /> <style type="text/css"> a:link { text-decoration: none; color: #000; } a:visited { text-decoration: none; color: #000; } a:hover { text-decoration: none; color: #333; } a:active { text-decoration: none; color: #666; } #wrapper #bodyArea .orderform { padding-left: 100px; padding-right: 100px; position: relative; color: #999; } </style> </head> <body> <div id="wrapper"> <div id="logo"><img src="images/banner.gif" width="800" height="110" alt="edson vehicle remarketing" /></div> <div id="navigation"><strong><a href="index.html">HOME</a> | <a href="inventory.html">INVENTORY</a> | <a href="financing.php">FINANCING</a> | <a href="orderform.html">ORDER FORM</a> | <a href="directions.html">DIRECTIONS</a> | <a href="contactus.html">CONTACT US</a></strong></div> <div id="bodyArea"> <div id="htmlforphp">Thank you for your interest.<br />Edson vehicle remarketinng will find you the best car possible!</div> </div> <div id="footer"><a href="index.html">home</a> | <a href="inventory.html">inventory</a> | <a href="financing.php">financing</a> | <a href="orderform.html">order form</a> | <a href="directions.html">directions</a> | <a href="contactus.html">contact us</a></div> </div> </body> </html> EOD; echo "$theResults"; ?> Hi All, Need your help with the situation I am stuck in. I have created a HTML Form and using PHP file saving that data into database. But now I want to send out an generic email to each visitor who fill the form. Attaching the code of html form and php database. It would be highly appreaciated if you can help me in updating the php file with which I can send an auto email.
HTML Form - <!-- .contact-form --> <div class="contact-form"> <form id="contact-form" class="validate-form" method="post" action="send.php"> <!-- enter mail subject here --> <input type="hidden" name="subject" id="subject" value="You have a new message from Smeet Mehta!"> <p> <label for="name">NAME</label> <input type="text" name="name" id="name" class="required"> </p> <p> <label for="email">EMAIL</label> <input type="text" name="email" id="email" class="required email"> </p> <p> <label for="message">MESSAGE</label> <textarea name="message" id="message" class="required"></textarea> </p> <p> <button class="submit" control-id="ControlId-5">Send</button> </p> </form> </div> <!-- .contact-form -->
PHP Code - <?php $subject = filter_input(INPUT_POST, 'subject'); $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $message = filter_input(INPUT_POST, 'message'); $host = "localhost"; $username = "root"; $password = ""; $dbname = "contact"; $conn = new mysqli ($host, $username, $password, $dbname); if (mysqli_connect_error()){ die('Connection Error('.mysqli_connect_error().')'.mysqli_connect_error()); } else { $sql = "INSERT INTO form (subject, name, email, message) values ('$subject', '$name', '$email', '$message')" ; if ($conn->query($sql)){ header("Refresh:0; url=index.html"); } else{ echo "Error: ".$sql ." ".$conn->error; } $conn->close(); } ?> Please Help Edited July 27 by Barandcode tags added Can anyone find a glaring error with my contact form or my mailer? I previously had a form that was working (sending the email through) but stopped working. It was more complicated before and had a recaptcha in it. I've been troubleshooting this for awhile now and can't figure out what's happening. I've stripped it down to just the basics. I'm stumped because I am correctly redirected to the confirmation.html page, yet no email has come through. I even put a simple test file (mailertest.php) on the server. The file is found and echoes "Mail sent", but no email is received. I contacted the host and they claim that things are fine on their end with the PHP mailer and it must be a problem in my code. As a newbie, I don't doubt that I'm doing something wrong, but I can't figure it out!
I'm attaching three files. Contact.php, contact_mailer.php and my test PHP file called mailertest.php. I'd appreciate any help that anyone can offer.
Attached Files
mailertest.php 99bytes
3 downloads
contact_mailer.php 608bytes
1 downloads
contact.php 7.55KB
0 downloads I'm using the example_form from securimage. I have modified the email address in the php script to my email address and uploaded everything to my hosting company's FTP server. I then fill out the form and click the submit message button and the form says "The captcha was correct and the message has been sent!" but I never receive the email. I have other basic php forms that work just fine just for some reason I can't get this one working. Could someone please let me know if I'm missing something here? Thanks I have a form with a captcha at the end of it (using securimage.php - http://www.phpcaptcha.org/documentation/quickstart/). But no matter what I enter into the field, it always gives me the error message: Quote: Quote The code you entered was incorrect. Go back and try again. If echo out $securimage->check($_POST['captcha_code']) Then I am given '1', which shows that the date entered does in fact match the text that is displayed within the captcha image. But it just seems to be ignoring this in the if statement! I've even tried simplifying the if statement like so: if (!$securimage->check($_POST['captcha_code'])) { But that STILL gives me the error message even when I've been sure to enter something into the name field. It's as if there is something about the if statement that the script just doesn't seem to like?! If anybody has any ideas what might be wrong that would be great Here's my code (please excuse the ugly HTML, it's not mine!) Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" /> --></style> <script type="text/javascript" src="script/jquery-1.4.2.min.js"></script> <link href="script/jquery-datepicker/datePicker.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="script/jquery-datepicker/date.js"></script> <script type="text/javascript" src="script/jquery-datepicker/jquery.datePicker.js"></script> <script type="text/javascript" src="script/jquery-datepicker/call.js"></script> <script type="text/javascript" src="script/jquery-datepicker/call-2.js"></script> <csscriptdict import="import"> <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script> </csscriptdict> <csactiondict> <script type="text/javascript"><!-- var preloadFlag = false; function preloadImages() { if (document.images) { pre_head1_up = newImage('images/head1_up.jpg'); pre_head8_up = newImage('images/head8_up.jpg'); pre_head8_down = newImage('images/head8_down.jpg'); pre_head7_up = newImage('images/head7_up.jpg'); pre_head3_up = newImage('images/head3_up.jpg'); pre_head6_up = newImage('images/head6_up.jpg'); pre_head4_up = newImage('images/head4_up.jpg'); pre_head5_up = newImage('images/head5_up.jpg'); preloadFlag = true; } } // --></script> </csactiondict> </head> <body onload="preloadImages();" bgcolor="#FFFFFF" text="#000000"> <div align="center"> <table width="750" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="00" rowspan="5" valign="top" width="79"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Curriculum','images/head1_up.jpg');MM_swapImage('Curriculum','','Images/head1_up.jpg',1);return true" onmouseout="changeImages('Curriculum','images/head1_down.jpg');MM_swapImgRestore();return true" href="curriculum.html" target="_self"><img src="images/head1_down.jpg" alt="Curriculum Button" name="Curriculum" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">Curriculum</font></b></h4> </div> </td> <td width="79" height="11"></td> <td width="79"></td> <td width="79"></td> <td rowspan="8" valign="bottom" width="119"><a href="index.html"><img src="images/sml_logo.jpg" alt="Tinks Logo Home Button" height="108" width="119" border="0"/></a></td> <td width="77"></td> <td width="79"></td> <td width="79"></td> <td class="00" rowspan="5" valign="top" width="79"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Contact_Us','images/head8_up.jpg');return true" onmouseout="changeImages('Contact_Us','images/head8_down.jpg');return true" href="contact.html" target="_self"><img src="images/head8_down.jpg" alt="Contact Us Buttons" name="Contact_Us" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS"><span>Contact Us</span></font></b></h4> </div> </td> <td width="1"></td> </tr> <tr> <td class="00" rowspan="5" valign="top"> <div align="center"> <h4 class="00"><img src="images/head2_down.jpg" alt="Register Button" name="Register" height="45" width="47" border="0"/><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">Register</font></b></h4> </div> </td> <td height="10"></td> <td></td> <td></td> <td></td> <td class="00" rowspan="5" valign="top" width="79"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Parents','images/head7_up.jpg');MM_swapImage('Parents','','Images/head7_up.jpg',1);return true" onmouseout="changeImages('Parents','images/head7_down.jpg');MM_swapImgRestore();return true" href="parents.html" target="_self"><img src="images/head7_down.jpg" alt="Parents Testimonials Button" name="Parents" height="45" width="47" border="0"/></a><br/> <font color="#0000CC"><b><font size="2" face="Comic Sans MS">Parent<br/> Testimonials</font></b></font></h4> </div> </td> <td></td> </tr> <tr> <td class="00" rowspan="5" valign="top"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Health&Safety','images/head3_up.jpg');MM_swapImage('Health&Safety','','Images/head3_up.jpg',1);return true" onmouseout="changeImages('Health&Safety','images/head3_down.jpg');MM_swapImgRestore();return true" href="health_safety.html" target="_self"><img src="images/head3_down.jpg" alt="Health & Safety Button" name="Health&Safety" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">Health & Safety</font></b></h4> </div> </td> <td height="12"></td> <td></td> <td class="00" rowspan="5" align="center" valign="top"> <div align="center"> <a onmouseover="MM_swapImage('Events','','Images/head6_up.jpg',1)" onmouseout="MM_swapImgRestore()" href="../../web/htdocs/events.htm"><font size="2" face="Comic Sans MS"><b></b></font></a> <h4 class="00"><a onmouseover="changeImages('Events','images/head6_up.jpg');return true" onmouseout="changeImages('Events','images/head6_down.jpg');return true" href="events.html"><img id="Events" src="images/head6_down.jpg" alt="Events Button" name="Events" height="45" width="47" border="0"/></a><font color="#0000CC"><b><font size="2" face="Comic Sans MS"><br/> Events</font></b></font></h4> </div> </td> <td></td> </tr> <tr> <td class="00" rowspan="5" valign="top"> <div align="center"> <h4 class="00"><a onmouseover="changeImages('Team','images/head4_up.jpg');MM_swapImage('Team','','Images/head4_up.jpg',1);return true" onmouseout="changeImages('Team','images/head4_down.jpg');MM_swapImgRestore();return true" href="team.html" target="_self"><img src="images/head4_down.jpg" alt="Team Button" name="Team" height="45" width="47" border="0"/></a><br/> <b><font size="2" color="#0000CC" face="Comic Sans MS">The Team</font></b></h4> </div> </td> <td height="8"></td> <td></td> </tr> <tr> <td class="00" rowspan="4" align="center" valign="top"> <h4 class="00"><a onmouseover="changeImages('Fees','images/head5_up.jpg');MM_swapImage('Fees','','Images/head5_up.jpg',1);return true" onmouseout="changeImages('Fees','images/head5_down.jpg');MM_swapImgRestore();return true" href="fees.html" target="_self"><img src="images/head5_down.jpg" alt="Fees Button" name="Fees" height="45" width="47" border="0"/></a><br/> <font color="#0000CC"><b><font size="2" face="Comic Sans MS">Fees</font></b></font></h4> </td> <td height="34"></td> </tr> <tr> <td height="19"></td> <td></td> <td></td> </tr> <tr> <td height="10"></td> <td></td> <td width="79"></td> <td></td> <td></td> </tr> <tr> <td height="12"></td> <td></td> <td></td> <td></td> <td width="79"></td> <td></td> <td></td> </tr> </table> <table width="742" border="0" cellpadding="0" cellspacing="0" height="300 " align="center"> <tr> <td height="72" valign="top" colspan="8"> <div align="center"> <h1 align="center"><font face="Comic Sans MS" size="6" color="#A94BD3"><b>Register</b></font></h1> </div> </script><div style="color:red;font-weight:bold;"></div> <form method="post" action="script/enquiry.php"> <input type="hidden" name="thankspage" value="register-thanks.php" /> <div><label>Child's Full Name <span class="highlight">*</span></label><input type="text" name="ChildsFullName" id="ChildsFullName" class="required" /></div> <div> <label for="DateDD">Date <span class="highlight">*</span></label> <select id="DateDD" name="DateDD"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select id="DateMM" name="DateMM"> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select id="DateYYYY" name="DateYYYY"> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> </select> <a id="date-pick" href="#" class="dp-applied"><img src="script/jquery-datepicker/image/frm-date.gif" /></a> </div> <div><label>Name of Parent/Guardian <span class="highlight">*</span></label><input type="text" name="ParentGuardian" id="ParentGuardian" /></div> <div> <div class="left"> <label>Address <span class="highlight">*</span></label> </div> <div class="right"> <div><label>Street Address</label><input type="text" name="StreetAddress" id="1234" /></div> <div><label>Address Line 2</label><input type="text" name="AddressLine2" id="1234" /></div> <div><label>City</label><input type="text" name="City" id="1234" /></div> <div><label>Post Code</label><input type="text" name="PostCode" id="1234" /></div> <div><label>State/Province/Region</label><input type="text" name="StateProvinceRegion" id="1234" /></div> <div><label>Country</label> <select name="Country" id="Country"><option value=""></option><optgroup label="North America"><option value="Antigua and Barbuda">Antigua and Barbuda</option><option value="Aruba,Bahamas">Aruba,Bahamas</option><option value="Barbados">Barbados</option><option value="Belize">Belize</option><option value="Canada">Canada</option><option value="Cook Islands">Cook Islands</option><option value="Costa Rica">Costa Rica</option><option value="Cuba">Cuba</option><option value="Dominica">Dominica</option><option value="Dominican Republic">Dominican Republic</option><option value="El Salvador">El Salvador</option><option value="Grenada">Grenada</option><option value="Guatemala">Guatemala</option><option value="Haiti">Haiti</option><option value="Honduras">Honduras</option><option value="Jamaica">Jamaica</option><option value="Mexico">Mexico</option><option value="Netherlands Antilles">Netherlands Antilles</option><option value="Nicaragua">Nicaragua</option><option value="Panama ">Panama </option><option value="Puerto Rico ">Puerto Rico </option><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option><option value="Saint Lucia">Saint Lucia</option><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option><option value="Trinidad and Tobago">Trinidad and Tobago</option><option value="United States">United States</option></optgroup><optgroup label="South America"><option value="Argentina">Argentina</option><option value="Bolivia">Bolivia</option><option value="Brazil">Brazil</option><option value="Chile">Chile</option><option value="Colombia">Colombia</option><option value="Ecuador">Ecuador</option><option value="Guyana">Guyana</option><option value="Paraguay">Paraguay</option><option value="Peru">Peru</option><option value="Suriname">Suriname</option><option value="Uruguay">Uruguay</option><option value="Venezuela">Venezuela</option></optgroup><optgroup label="Europe"><option value="Albania">Albania</option><option value="Andorra">Andorra</option><option value="Armenia">Armenia</option><option value="Austria">Austria</option><option value="Azerbaijan">Azerbaijan</option><option value="Belarus">Belarus</option><option value="Belgium">Belgium</option><option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option><option value="Bulgaria">Bulgaria</option><option value="Croatia">Croatia</option><option value="Cyprus">Cyprus</option><option value="Czech Republic">Czech Republic</option><option value="Denmark">Denmark</option><option value="Estonia">Estonia</option><option value="Faroe Islands">Faroe Islands</option><option value="Finland">Finland</option><option value="France">France</option><option value="Georgia">Georgia</option><option value="Germany">Germany</option><option value="Greece">Greece</option><option value="Hungary">Hungary</option><option value="Iceland">Iceland</option><option value="Ireland">Ireland</option><option value="Italy">Italy</option><option value="Latvia">Latvia</option><option value="Liechtenstein">Liechtenstein</option><option value="Lithuania">Lithuania</option><option value="Luxembourg">Luxembourg</option><option value="Macedonia">Macedonia</option><option value="Malta">Malta</option><option value="Moldova">Moldova</option><option value="Monaco">Monaco</option><option value="Montenegro">Montenegro</option><option value="Netherlands">Netherlands</option><option value="Norway">Norway</option><option value="Poland">Poland</option><option value="Portugal">Portugal</option><option value="Romania">Romania</option><option value="San Marino">San Marino</option><option value="Serbia">Serbia</option><option value="Slovakia">Slovakia</option><option value="Slovenia">Slovenia</option><option value="Spain">Spain</option><option value="Sweden">Sweden</option><option value="Switzerland">Switzerland</option><option value="Ukraine">Ukraine</option><option selected="selected" value="United Kingdom">United Kingdom</option><option value="Vatican City">Vatican City</option></optgroup><optgroup label="Asia"><option value="Afghanistan">Afghanistan</option><option value="Bahrain">Bahrain</option><option value="Bangladesh">Bangladesh</option><option value="Bhutan">Bhutan</option><option value="Brunei Darussalam">Brunei Darussalam</option><option value="Myanmar">Myanmar</option><option value="Cambodia">Cambodia</option><option value="China">China</option><option value="East Timor">East Timor</option><option value="Hong Kong">Hong Kong</option><option value="India">India</option><option value="Indonesia">Indonesia</option><option value="Iran">Iran</option><option value="Iraq">Iraq</option><option value="Israel">Israel</option><option value="Japan">Japan</option><option value="Jordan">Jordan</option><option value="Kazakhstan">Kazakhstan</option><option value="North Korea">North Korea</option><option value="South Korea">South Korea</option><option value="Kuwait">Kuwait</option><option value="Kyrgyzstan">Kyrgyzstan</option><option value="Laos">Laos</option><option value="Lebanon">Lebanon</option><option value="Malaysia">Malaysia</option><option value="Maldives">Maldives</option><option value="Mongolia">Mongolia</option><option value="Nepal">Nepal</option><option value="Oman">Oman</option><option value="Pakistan">Pakistan</option><option value="Palestine">Palestine</option><option value="Philippines">Philippines</option><option value="Qatar">Qatar</option><option value="Russia">Russia</option><option value="Saudi Arabia">Saudi Arabia</option><option value="Singapore">Singapore</option><option value="Sri Lanka">Sri Lanka</option><option value="Syria">Syria</option><option value="Taiwan">Taiwan</option><option value="Tajikistan">Tajikistan</option><option value="Thailand">Thailand</option><option value="Turkey">Turkey</option><option value="Turkmenistan">Turkmenistan</option><option value="United Arab Emirates">United Arab Emirates</option><option value="Uzbekistan">Uzbekistan</option><option value="Vietnam">Vietnam</option><option value="Yemen">Yemen</option></optgroup><optgroup label="Oceania"><option value="Australia">Australia</option><option value="Fiji">Fiji</option><option value="Kiribati">Kiribati</option><option value="Marshall Islands">Marshall Islands</option><option value="Micronesia">Micronesia</option><option value="Nauru">Nauru</option><option value="New Zealand">New Zealand</option><option value="Palau">Palau</option><option value="Papua New Guinea">Papua New Guinea</option><option value="Samoa">Samoa</option><option value="Solomon Islands">Solomon Islands</option><option value="Tonga">Tonga</option><option value="Tuvalu">Tuvalu</option><option value="Vanuatu">Vanuatu</option></optgroup><optgroup label="Africa"><option value="Algeria">Algeria</option><option value="Angola">Angola</option><option value="Benin">Benin</option><option value="Botswana">Botswana</option><option value="Burkina Faso">Burkina Faso</option><option value="Burundi">Burundi</option><option value="Cameroon">Cameroon</option><option value="Cape Verde">Cape Verde</option><option value="Central African Republic">Central African Republic</option><option value="Chad">Chad</option><option value="Comoros">Comoros</option><option value="Democratic Republic of the Congo">Democratic Republic of the Congo</option><option value="Republic of the Congo">Republic of the Congo</option><option value="Djibouti">Djibouti</option><option value="Egypt">Egypt</option><option value="Equatorial Guinea">Equatorial Guinea</option><option value="Eritrea">Eritrea</option><option value="Ethiopia">Ethiopia</option><option value="Gabon">Gabon</option><option value="Gambia">Gambia</option><option value="Ghana">Ghana</option><option value="Gibraltar">Gibraltar</option><option value="Guinea">Guinea</option><option value="Guinea-Bissau">Guinea-Bissau</option><option value="Cote d'Ivoire">Cote d'Ivoire</option><option value="Kenya">Kenya</option><option value="Lesotho">Lesotho</option><option value="Liberia">Liberia</option><option value="Libya">Libya</option><option value="Madagascar">Madagascar</option><option value="Malawi">Malawi</option><option value="Mali">Mali</option><option value="Mauritania">Mauritania</option><option value="Mauritius">Mauritius</option><option value="Morocco">Morocco</option><option value="Mozambique">Mozambique</option><option value="Namibia">Namibia</option><option value="Niger">Niger</option><option value="Nigeria">Nigeria</option><option value="Rwanda">Rwanda</option><option value="Sao Tome and Principe">Sao Tome and Principe</option><option value="Senegal">Senegal</option><option value="Seychelles">Seychelles</option><option value="Sierra Leone">Sierra Leone</option><option value="Somalia">Somalia</option><option value="South Africa">South Africa</option><option value="Sudan">Sudan</option><option value="Swaziland">Swaziland</option><option value="United Republic of Tanzania">United Republic of Tanzania</option><option value="Togo">Togo</option><option value="Tunisia">Tunisia</option><option value="Uganda">Uganda</option><option value="Zambia">Zambia</option><option value="Zimbabwe">Zimbabwe</option></optgroup></select> </div> </div> </div> <div><label>Phone Number <span class="highlight">*</span></label><input type="text" name="PhoneNumber" id="1234" /></div> <div><label>Place of work</label><input type="text" name="PlaceOfWork" id="1234" /></div> <div> <label>Mornings only</label> <div class="right"> <input type="checkbox" name="MorningsOnly" value="Monday" />Monday <input type="checkbox" name="MorningsOnly" value="Tuesday" />Tuesday <input type="checkbox" name="MorningsOnly" value="Wednesday" />Wednesday <input type="checkbox" name="MorningsOnly" value="Thursday" />Thursday <input type="checkbox" name="MorningsOnly" value="Friday" />Friday <p>Please indicate the sessions you wish your child to attend by ticking the appropriate boxes:</p> </div> </div> <div> <label>Afternoons only</label> <div class="right"> <input type="checkbox" name="AfternoonsOnly" value="Monday" />Monday <input type="checkbox" name="AfternoonsOnly" value="Tuesday" />Tuesday <input type="checkbox" name="AfternoonsOnly" value="Wednesday" />Wednesday <input type="checkbox" name="AfternoonsOnly" value="Thursday" />Thursday <input type="checkbox" name="AfternoonsOnly" value="Friday" />Friday <p>Please indicate the sessions you wish your child to attend by ticking the appropriate boxes:</p> </div> </div> <div> <label>Full days</label> <div class="right"> <input type="checkbox" name="FullDays" value="Monday" />Monday <input type="checkbox" name="FullDays" value="Tuesday" />Tuesday <input type="checkbox" name="FullDays" value="Wednesday" />Wednesday <input type="checkbox" name="FullDays" value="Thursday" />Thursday <input type="checkbox" name="FullDays" value="Friday" />Friday <p>Please indicate the sessions you wish your child to attend by ticking the appropriate boxes:</p> </div> </div> <div><label>Does your child have special requirements?</label><input type="text" name="SpecialRequirements" id="SpecialRequirements" /></div> <div><label>Please provide any other relevant information </label><input type="text" name="RelevantInfo" id="RelevantInfo" /></div> <div> <div> <label for="DateStartDD">Date you wish your child to start</label> <select id="DateStartDD" name="DateStartDD"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select id="DateStartMM" name="DateStartMM"> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select id="DateStartYYYY" name="DateStartYYYY"> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> </select> <a id="date-pick-2" href="#" class="dp-applied"><img src="script/jquery-datepicker/image/frm-date.gif" /></a> </div> </div> <div><label>Email <span class="highlight">*</span></label><input type="text" name="submitteremail" id="Email" /></div> <div id="captcha-div"> <label>Please type the text displayed in the image</label> <img id="captcha" src="script/securimage/securimage_show.php" alt="CAPTCHA Image" /> <input type="text" name="captcha_code" size="10" maxlength="6" /> </div> <div><input type="submit" name="submit" value="Submit" /></div> </form> </html> <?php session_start(); include_once 'securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { die('The code you entered was incorrect. Go back and try again.'); } ?> <?php *** Rest of PHP script to send email *** I got this PHP mailer as part of a template I downloaded. It seems to work for everyone except for me. I would love some help. I followed their documentation as for what to change and you will see it documented as to the area I was supposed to change and the part I should not touch. I only updated the top portion but for some reason its not working. When I tested the contact page after uploading the site, I used one of my own email addresses to send an email to the destination address of my company. I get a response email in the account that I fill in the email field with, but the actual destination email account for my business never gets the message that the customer/I write. This is the code I have so far, so could you please tell me whats wrong. Thanks! Sorry I cant upload files at work. Code: [Select] <?php error_reporting(E_WARNING); $variables = array( "subject" => $_POST["sender_subject"], "message" => $_POST["sender_message"], "name" => $_POST["sender_name"], "email" => $_POST["sender_email"], ); $conf = array( "notification_email" => array( "enable" => true, "to" => "shane@photographybysp.com", "to_name" => "Photography by Shane Padgett", "from" => "{EMAIL}", "from_name" => "{NAME}", "subject" => "New Message: {SUBJECT}", "type" => "html", "message" => <<<EOD <p>Someone new is interested!</p> <p> Email: {EMAIL}<br> Subject: {SUBJECT}<br> {MESSAGE} </p> EOD ), "autoresponder_email" => array( "enable" => true, "from" => "shane@photographybysp.com", "from_name" => "Photography by Shane Padgett", "to" => "{EMAIL}", "to_name" => "{NAME}", "subject" => "Thank you for your message", "type" => "html", "message" => <<<EOD <p>Your message has been recieved!</p> <p> Email: {EMAIL}<br> Subject: {SUBJECT}<br> {MESSAGE} </p> EOD ), ); ## starting the actual code, you have nothing else to configure from this point forward. function SendMail() { $params = AStripSlasshes(func_get_args()); //check to see the numbers of the arguments switch (func_num_args()) { case 1: $email = $params[0]; $vars = array(); break; case 2: $email = $params[0]; $vars = $params[1]; break; case 3: $to = $params[0]; $email = $params[1]; $vars = $params[2]; break; case 4: $to = $params[0]; $to_name = $params[1]; $email = $params[2]; $vars = $params[3]; break; } if ($email["email_status"] == 1) { return true; } $msg = new CTemplate(stripslashes($email["email_body"]) , "string"); $msg = $msg->Replace($vars); $sub = new CTemplate(stripslashes($email["email_subject"]) , "string"); $sub = $sub->Replace($vars); $email["email_from"] = new CTemplate(stripslashes($email["email_from"]) , "string"); $email["email_from"] = $email["email_from"]->Replace($vars); $email["email_from_name"] = new CTemplate(stripslashes($email["email_from_name"]) , "string"); $email["email_from_name"] = $email["email_from_name"]->Replace($vars); if (!$email["email_reply"]) $email["email_reply"] = $email["email_from"]; if (!$email["email_reply_name"]) $email["email_reply_name"] = $email["email_from_name"]; //prepare the headers $headers = "MIME-Version: 1.0\r\n"; if ($email["email_type"] == "html") $headers .= "Content-type: text/html\r\n"; else $headers .= "Content-type: text/plain\r\n"; //prepare the from fields if (!$email["email_hide_from"]) { $headers .= "From: {$email[email_from_name]}<{$email[email_from]}>\r\n"; $headers .= "Reply-To: {$email[email_reply_name]}<{$email[email_reply]}>\r\n"; } $headers .= $email["headers"]; if (!$email["email_hide_to"]) { return @mail($email["email_to"] , $sub, $msg,$headers); } else { } $headers .= "X-Mailer: PHP/" . phpversion(); return mail($to, $sub, $msg,$headers); } function AStripSlasshes($array) { if (is_array($array)) foreach ($array as $key => $item) if (is_array($item)) $array[$key] = AStripSlasshes($item); else $array[$key] = stripslashes($item); else return stripslashes($array); return $array; } $_TSM = array(); class CTemplate { /** * template source data * * @var string * * @access private */ var $input; /** * template result data * * @var string * * @access public */ var $output; /** * template blocks if any * * @var array * * @access public */ var $blocks; /** * constructor which autoloads the template data * * @param string $source source identifier; can be a filename or a string var name etc * @param string $source_type source type identifier; currently file and string supported * * @return void * * @acces public */ function CTemplate($source,$source_type = "file") { $this->Load($source,$source_type); } /** * load a template from file. places the file content into input and output * also setup the blocks array if any found * * @param string $source source identifier; can be a filename or a string var name etc * @param string $source_type source type identifier; currently file and string supported * * @return void * * @acces public */ function Load($source,$source_type = "file") { switch ($source_type) { case "file": $this->template_file = $source; // get the data from the file $data = GetFileContents($source); //$data = str_Replace('$','\$',$data); break; case "rsl": case "string": $data = $source; break; } // blocks are in the form of <!--S:BlockName-->data<!--E:BlockName--> preg_match_all("'<!--S\:.*?-->.*?<!--E\:.*?-->'si",$data,$matches); // any blocks found? if (count($matches[0]) != 0) // iterate thru `em foreach ($matches[0] as $block) { // extract block name $name = substr($block,strpos($block,"S:") + 2,strpos($block,"-->") - 6); // cleanup block delimiters $block = substr($block,9 + strlen($name),strlen($block) - 18 - strlen($name) * 2); // insert into blocks array $this->blocks["$name"] = new CTemplate($block,"string"); } // cleanup block delimiters and set the input/output $this->input = $this->output = preg_replace(array("'<!--S\:.*?-->(\r\n|\n|\n\r)'si","'<!--E\:.*?-- >(\r\n|\n|\n\r)'si"),"",$data); } /** * replace template variables w/ actual values * * @param array $vars array of vars to be replaced in the form of "VAR" => "val" * @param bool $clear reset vars after replacement? defaults to TRUE * * @return string the template output * * @acces public */ function Replace($vars,$clear = TRUE) { if (is_array($vars)) { foreach ($vars as $key => $var) { if (is_array($var)) { unset($vars[$key]); } } } // init some temp vars $patterns = array(); $replacements = array(); // build patterns and replacements if (is_array($vars)) // just a small check foreach ($vars as $key => $val) { $patterns[] = "/\{" . strtoupper($key) . "\}/"; //the $ bug $replacements[] = str_replace('$','\$',$val); } // do regex $result = $this->output = @preg_replace($patterns,$replacements,$this->input); // do we clear? if ($clear == TRUE) $this->Clear(); // return output return $result; } function SepReplace($ssep , $esep , $vars,$clear = TRUE) { if (is_array($vars)) { foreach ($vars as $key => $var) { if (is_array($var)) { unset($vars[$key]); } } } // init some temp vars $patterns = array(); $replacements = array(); // build patterns and replacements if (is_array($vars)) // just a small check foreach ($vars as $key => $val) { $patterns[] = $ssep . strtoupper($key) . $esep; //the $ bug $replacements[] = str_replace('$','\$',$val); } // do regex $result = $this->output = @preg_replace($patterns,$replacements,$this->input); // do we clear? if ($clear == TRUE) $this->Clear(); // return output return $result; } /** * replace a single template variable * * @param string $var variable to be replaced * @param string $value replacement * @param bool $perm makes the change permanent [i.e. replaces input also]; defaults to FALSE * * @return string result of replacement * * @acces public */ function ReplaceSingle($var,$value,$perm = FALSE) { if ($perm) $this->input = $this->Replace(array("$var" => $value)); else return $this->Replace(array("$var" => $value)); } /** * resets all the replaced vars to their previous status * * @return void * * @acces public */ function Clear() { $this->output = $this->input; } /** * voids every template variable * * @return void * * @acces public */ function EmptyVars() { global $_TSM; //$this->output = $this->ReplacE($_TSM["_PERM"]); //return$this->output = preg_replace("'{[A-Z]}'si","",$this->output); return $this->output = preg_replace("'{[A-Z_\-0-9]*?}'si","",$this->output); //return $this->output = preg_replace("'{[\/\!]*?[^{}]*?}'si","",$this->output); } /** * checks if the specified template block exists * * @param string $block_name block name to look for * * @return bool TRUE if exists or FALSE if it doesnt * * @access public */ function BlockExists($block_name) { return isset($this->blocks[$block_name]) && is_object($this->blocks[$block_name])? TRUE : FALSE; } /* function Block($block,$vars = array(),$return_error = false) { if ($this->BlockExists($block)) return $this->blocks[$block]->Replace($vars); else { return ""; } } */ /*Extra functions to keep the compatibility with the new CTemplateDynamic library*/ /** * description * * @param * * @return * * @access */ function BlockReplace($block , $vars = array(), $clear = true){ if (!is_object($this->blocks[$block])) echo "CTemplate::{$this->template_file}::$block Doesnt exists.<br>"; return $this->blocks[$block]->Replace($vars , $clear); } /** * description * * @param * * @return * * @access */ function BlockEmptyVars($block , $vars = array(), $clear = true) { if (!is_object($this->blocks[$block])) echo "CTemplate::{$this->template_file}::$block Doesnt exists.<br>"; if (is_array($vars) && count($vars)) $this->blocks[$block]->Replace($vars , false); return $this->blocks[$block]->EmptyVars(); } /** * description * * @param * * @return * * @access */ function Block($block) { if (!is_object($this->blocks[$block])) echo "CTemplate::{$this->template_file}::$block Doesnt exists.<br>"; return $this->blocks[$block]->output; } } /** * description * * @library * @author * @since */ class CTemplateStatic{ /** * description * * @param * * @return * * @access */ /** * description * * @param * * @return * * @access */ function Replace($tmp , $data = array()) { $template = new CTemplate($tmp , "string"); return $template->replace($data); } function EmptyVars($tmp , $data = array()) { $template = new CTemplate($tmp , "string"); if (count($data)) { $template->replace($data , false); } return $template->emptyvars(); } /** * description * * @param * * @return * * @access */ function ReplaceSingle($tmp , $var , $value) { return CTemplateStatic::Replace( $tmp , array( $var => $value ) ); } } header("Content-Type: text/xml"); if (!$variables["email"]) { echo "<response><message>error</message></response>"; die(); } if(!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$variables["email"])){ echo "<response><message>error</message></response>"; die(""); } //check if the notification should be sent if ($conf["notification_email"]["enable"] == true) { $vars = $variables; foreach ($conf["notification_email"] as $key => $val) { $conf["notification_email"][$key] = CTemplateStatic::Replace($val , $vars); } //process the notify email $email = array( "email_to" => utf8_decode($conf["notification_email"]["to"]), "email_to_name" => utf8_decode($conf["notification_email"]["to_name"]), "email_from" => utf8_decode($conf["notification_email"]["from"]), "email_from_name" => utf8_decode($conf["notification_email"]["from_name"]), "email_subject" => utf8_decode($conf["notification_email"]["subject"]), "email_body" => utf8_decode($conf["notification_email"]["message"]), "email_type" => utf8_decode($conf["notification_email"]["type"]) ); foreach ($email as $key => $val) { $email[$key] = CTemplateStatic::Replace($val , $vars); } SendMail($email); } //check if the notification should be sent if ($conf["autoresponder_email"]["enable"] == true) { $vars = $variables; foreach ($conf["autoresponder_email"] as $key => $val) { $conf["autoresponder_email"][$key] = CTemplateStatic::Replace($val , $vars); } //process the notify email $email = array( "email_to" => utf8_decode($conf["autoresponder_email"]["to"]), "email_to_name" => utf8_decode($conf["autoresponder_email"]["to_name"]), "email_from" => utf8_decode($conf["autoresponder_email"]["from"]), "email_from_name" => utf8_decode($conf["autoresponder_email"]["from_name"]), "email_subject" => utf8_decode($conf["autoresponder_email"]["subject"]), "email_body" => utf8_decode($conf["autoresponder_email"]["message"]), "email_type" => utf8_decode($conf["autoresponder_email"]["type"]) ); foreach ($email as $key => $val) { $email[$key] = CTemplateStatic::Replace($val , $vars); } SendMail($email); } echo "<response><message>sent</message></response>"; die(); ?> MOD EDIT: [code] . . . [/code] tags added. Hi everyone! Newbie in PHP Im trying unsuccessfully to get php mailer to send mail to a specific email address I dont know if its even possible. I have a form in flash but it uses php. Now all the emails that get sent from the site go to a ddatabase and then are posted in the site admin area under contact Im assuming its php mail that send sends these emails. What i would like is it to send those emails to a specific address. I downloaded the latest phpmailer for php 4 since thats what the server is running. Any help would be appreciated. Here ive attached the current mailer file. THANKS. PEACE OK so to start. We have our domain in the format X.com. Our new-mail form (php) is under mails.X.com. We use phpmail for sending mails. Receiving is disabled. There is apcall for mail() function in button's onclick event. Works as intended (gets call transmitted to phpmail function as well as MTP's) but mails never leaves our servers (and reaches receipient(s)). What may the problem be? Hi guys I need some help here about mailer. I have created a file register new user (register.php) and when a new user register an email will be sent to their address. I have this code on my register file but when I run them it's okay but I did not get the email... can anyone assist me what I did wrong? Thanks. <?php $to = "someone@example.com"; //change to a valid email $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; //change to a valid email $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Here's my situation: I had someone create a PHP form for me. I have inserted it into a website I am designing. The form works on my personal host (except still trying to figure out how to have the uploaded file be attached to the sent email), but I am getting an error where the form will actually be hosted. See below. Please let me know if any more info is needed. Form: http://www.jjbuttons.com/order Error on submission: Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/j/u/m/jumpinjack/html/form/attach_mailer_class.php on line 186 Error while sending you mail. Host: GoDaddy PHP version: 4.4.9 http://www.jjbuttons.com/info.php Same form / code: http://www.chrisdoughmandesign.com/order.html Mail submits (except still trying to figure out how to have uploaded file be attached to email) Host: JustHost PHP version: 5.2.16 http://www.chrisdoughmandesign.com/info.php Code: [Select] <?php if(isset($_POST['cmd']) && ($_POST['cmd'] == 'complete')) { if(isset($_POST['completeorder'])) { //UPDATE THESE VARIABLES $to = 'user@example.com'; // TODO: Change to your desired email. $cc = ""; //OPTIONAL $bcc = ""; //OPTIONAL $subject = 'Order Form Submission'; //TODO: Update to a subject for the email that you like $uploadpath = $_SERVER['DOCUMENT_ROOT']."/files/mail/"; //TODO: Change path to match your environment $max_size = 1024*2; //TODO: Update the max. size for uploading in kbs require($_SERVER['DOCUMENT_ROOT']."/form/attach_mailer_class.php"); //TODO: Change path to match your environment include ($_SERVER['DOCUMENT_ROOT']."/form/upload_class.php"); //TODO: Change path to match your environment //EDITTING BELOW THIS SHOULD NOT BE NECESSARY $name = $_POST['fname'] . ' ' . $_POST['lname']; $from = $_POST['email']; $msg = ""; $body =' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style> .rounded_corners { border-radius: 15px; -moz-border-radius: 15px; } fieldset { margin:10px auto; } #commentForm label.error, #commentForm input.submit { margin-left: 10px; } </style> </head> <body> <div style="margin:0 auto; width:900px; padding:10px;"> <fieldset class="rounded_corners"> <LEGEND ACCESSKEY=I style="font-weight:bold; padding:1px 5px;"> Billing / Shipping Information</LEGEND> <div style="float:left; width:430px; "> <div class="rounded_corners" style="background-color:#EEE; padding:5px; font-weight:bold; ">Bill To:</div> <div> <table style="margin-left:5px; width:100%:" cellpadding="3" cellspacing="0"> <tr> <td style="width:110px; text-align:right;">* First Name:</td> <td style="width:290px;">'.$_POST['fname'].'</td> </tr> <tr> <td style="text-align:right;">* Last Name:</td> <td>'.$_POST['lname'].'</td> </tr> <tr> <td style="text-align:right;">Company:</td> <td>'.$_POST['company'].'</td> </tr> <tr> <td style="text-align:right;">Address 1</td> <td>'.$_POST['add1'].'</td> </tr> <tr> <td style="text-align:right;">Address 2</td> <td>'.$_POST['add2'].'</td> </tr> <tr> <td style="text-align:right;">City:</td> <td>'.$_POST['city'].'</td> </tr> <tr> <td style="text-align:right;">State:</td> <td>'.$_POST['state'].'</td> </tr> <tr> <td style="text-align:right;">* Zip:</td> <td>'.$_POST['zip'].'</td> </tr> <tr> <td style="text-align:right;">* Phone:</td> <td>'.$_POST['phone'].'</td> </tr> <tr> <td style="text-align:right;">* Email:</td> <td>'.$_POST['email'].'</td> </tr> </table> </div> </div> <div style="float:right; width:430px;"> <div class="rounded_corners" style="background-color:#EEE; padding:5px; font-weight:bold; "> <span style="float:left;">Ship To:</span> <span style="float:right;"><input type="checkbox" name="sameasbilling" id="sameasbilling" /></span> <div style="clear:both; height:1px;"></div> </div> <div> <table style="margin-left:5px; width:100%:" cellpadding="3" cellspacing="0"> <tr> <td style="width:110px; text-align:right;">* First Name:</td> <td style="width:290px;">'.$_POST['fname2'].'</td> </tr> <tr> <td style="text-align:right;">* Last Name:</td> <td>'.$_POST['lname2'].'</td> </tr> <tr> <td style="text-align:right;">Company:</td> <td>'.$_POST['company2'].'</td> </tr> <tr> <td style="text-align:right;">Address 1</td> <td>'.$_POST['add12'].'</td> </tr> <tr> <td style="text-align:right;">Address 2</td> <td>'.$_POST['add22'].'</td> </tr> <tr> <td style="text-align:right;">City:</td> <td>'.$_POST['city2'].'</td> </tr> <tr> <td style="text-align:right;">State:</td> <td>'.$_POST['state2'].'</td> </tr> <tr> <td style="text-align:right;">* Zip:</td> <td>'.$_POST['zip2'].'</td> </tr> <tr> <td style="text-align:right;">* Phone:</td> <td>'.$_POST['phone2'].'</td> </tr> </table> </div> </div> <div style="clear:both; height:1px;"></div> <div style="width:100%; text-align:center;"> * indicates required information</div> </fieldset> <fieldset class="rounded_corners"> <legend accesskey="2" style="font-weight:bold; padding:1px 5px;"> Order</LEGEND> <div class="rounded_corners" style="background-color:#EEE; padding:5px; font-weight:bold; "> <table style="width:100%;"> <tr> <td style="width: 150px;"></td> <td style="font-weight:bold; text-align:center;">Button Size</td> <td style="font-weight:bold; text-align:center;">Quantity</td> <td style="font-weight:bold; text-align:center;">Button Back</td> <td style="font-weight:bold; text-align:center;"></td> </tr> </table> </div> <div style="width:100%; padding:5px;"> <table style="width:100%;" cellpadding="2"> <tr> <td style="width: 150px; text-align:center; font-weight:bold;">* Product 1</td> <td style="">'.$_POST['size1'].'</td> <td style="">'.$_POST['qty1'].'</td> <td style="">'.$_POST['back1'].'</td> <td style=""></td> </tr>'; if(isset($_POST['size2']) && isset($_POST['qty2']) && isset($_POST['back2'])) { $body .= '<tr> <td style="width: 150px; text-align:center; font-weight:bold;">Product 2</td> <td style="">'.$_POST['size2'].'</td> <td style="">'.$_POST['qty2'].'</td> <td style="">'.$_POST['back2'].'</td> <td style=""></td> </tr>'; } if(isset($_POST['size3']) && isset($_POST['qty3']) && isset($_POST['back3'])) { $body .= '<tr> <td style="width: 150px; text-align:center; font-weight:bold;">Product 3</td> <td style="width: 150px; text-align:center; font-weight:bold;">Product 2</td> <td style="">'.$_POST['size3'].'</td> <td style="">'.$_POST['qty3'].'</td> <td style="">'.$_POST['back3'].'</td> <td style=""></td> </tr>'; } if(isset($_POST['size4']) && isset($_POST['qty4']) && isset($_POST['back4'])) { $body .= '<tr> <td style="width: 150px; text-align:center; font-weight:bold;">Product 4</td> <td style="width: 150px; text-align:center; font-weight:bold;">Product 2</td> <td style="">'.$_POST['size4'].'</td> <td style="">'.$_POST['qty4'].'</td> <td style="">'.$_POST['back4'].'</td> <td style=""></td> </tr>'; } $body .= '</table> </div> </fieldset> <fieldset class="rounded_corners"> <LEGEND accesskey="3" style="font-weight:bold; padding:1px 5px;">Miscellaneous Info</LEGEND> <table cellpadding="5"> <tr> <td style="width:280px; text-align:center;">*When do you need your order?</td> <td style="width:280px; text-align:center;">'.$_POST['month'].'</td> <td style="width:280px; text-align:center;">'.$_POST['days'].'</td> </tr> <tr> <td style="width:280px; text-align:center;">Is this a Quote or an Order?</td> <td style="width:280px; text-align:center;">'.$_POST['saletype'].'</td> <td style="width:280px; text-align:center;"></td> </tr> <tr> <td style="width:280px; text-align:center;">Have you ordered from us before?</td> <td style="width:280px; text-align:center;">'.$_POST['prevorder'].'</td> <td style="width:280px; text-align:center;"></td> </tr> <tr> <td colspan="3" style="width:100%; text-align:center; font-weight:bold;"> Comments, questions, special instructions: </td> </tr> <tr> <td colspan="3" style="width:100%; text-align:center;"> '.$_POST['comments'].' </td> </tr> </table> </fieldset> </div> </body> </html>'; $my_mail = new attach_mailer($name , $from , $to, $cc , $bcc, $subject, $body); if (isset($_FILES)) { foreach ($_FILES as $key => $file) { for($i = 0; $i < count($file['name']); $i++) { if(isset($file['tmp_name'][$i]) && $file['tmp_name'][$i] != '') { $my_upload = new file_upload; $my_upload->extensions = array(".ai", ".eps", ".pdf", ".psd", ".jpg", ".jpeg"); $my_upload->rename_file = false; $my_upload->upload_dir = $uploadpath; $my_upload->the_temp_file = $file['tmp_name'][$i]; $my_upload->the_file = $file['name'][$i]; $my_upload->http_error = $file['error'][$i]; if ($my_upload->upload()) { $full_path = $my_upload->upload_dir.$my_upload->file_copy; $my_mail->create_attachment_part($full_path); $my_upload->del_temp_file($full_path); } $msg .= $my_upload->show_error_string(); } } } } $my_mail->process_mail(); $msg .= $my_mail->get_msg_str(); echo $msg; } } elseif(isset($_POST['cmd']) && $_POST['cmd'] == 'set_opts') { switch ($_POST['selected']) { case '1\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back','Zipper Pull'); break; case '1.25\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back','Zipper Pull'); break; case '2.25\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back', 'Bottle Opener', 'Bottle Opener With Key Ring'); break; case '3\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '3.5\" Round': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '2x3\" Rectangle': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '3x2\" Vertical Rectangle': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '2x2 Square': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case '2x2 Diamond': $options = array('Select Back Button', 'Pin Back','Magnet Back'); break; case 'Select Button Size': $options = array('Select Back Button'); break; } echo json_encode(array('result' => $options)); } ?> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=306860.0 Hi there! I have two different hosting services: on the first one I can regularly use the function mail(), but the second does not allow me to send mails (it will block the account for mass mailing). I need to use mail to notify things to user who requested it, so I need to be able to send mail from this second server too. I thought that I will create a mailer script on the firs server, so that the second will simply call the script when needed, passing the e-mail addresses, the subject and content trough POST. Now, how to avoid that some malicious user uses my script to send own mails? I thought that I can send with the POST two vars, "time" and "secure_code" (I will eventually fake the names, so that is not so easy to recognize), where "time" is get by time(), and "secure_code" is a function depending on the value of "time". The mailer script gets the both values, and use the same function to verify if the "secure_code" is correct, according to time. Question is, is this safe? What kind of function shall I use? Also, how could I avoid that a malicious user simply same the "time" and "secure_code" in a certain moment, and use it again? Thanks in advance. i want to send products to resellers so they can show it to their clients but to show it not on my domain i thought of sending an email with html designed as my product details page BUT the problem here is that the forwarding action by my reseller will ruin the html mailer i thought of using php to pdf any other solutions thanks Is there a way of getting today's date (in European format - day-month-year) into the body of an email sent via phpmailer? Many thanks. does anyone have any update on this? I am using it pretty heavily, and someone who has a gmail account just told me that their message was sent to spam. I have a gmail account myself and last night I ran a test and it was not sent there for me. I guess google could be doing some algorithmic nonsense to analyze behavior patterns, but I would guess not in this case. Does anyone know the status of some of the major email clients and their acceptance of PHP mailer receipts? I know the DNS is also associated, but the test that I ran myself came to the inbox without the need for a DNS change. gmail simply popped up a warning of information. thank you guys. I'm just fishing for info here as to see what I can do to stop this. |