PHP - Mail() Returns False But Email Is Sent
Hi, I'm pretty new to PHP and I am working on a form that sends and email. I want to display a message if the mail can't be sent (i.e. if mail() returns false) and a different message if mail() returns true, except it is returning false even though the emails are sending.
Basically I have used: $to = 'myemail@email.com'; $subject = "Subject Line Goes here"; $headers = "From: $email"; $message = 'My message'; $mailSent = mail($to, $subject, $message, $headers); In testing it I have used the following to determine what is going on: if (isset($mailSent)) { echo '$mailSent ='.$mailSent; } - echo's nothing if ($mailSent == FALSE) { echo '$mailSent = FALSE'; } - echo's '$mailSent = FALSE' if ($mailSent == TRUE) { echo '$mailSent = TRUE'; } - echo's nothing if (is_null($mailSent)) { echo '$mailSent = NULL'; } - echo's '$mailSent = NULL' echo '$mailSent ='.$mailSent; - echo's '$mailSent =' Any help would be greatly appreciated! Thanks! Similar TutorialsHi, I am trying to verify if the given url exists or not, by using file_exists() function. It always returns 'FALSE' , according to my understanding it happening because the file to be checked on the given url is located in safe mode. Could anyone please suggest as to how this could be overcome, by similar function or by using alternative method. Regards Abhishek Madhani I am trying to unserialize this string: a:3:{s:3:\"zip\";s:5:\"55068\";s:4:\"city\";s:9:\"Rosemount\";s:5:\"state\";s:2:\"MN\";} but I unserialize is returning false. Why is it doing that? $info = unserialize($_COOKIE['zipcode']); var_dump($info); I'm working on a WordPress theme and I'm trying to build in a simple if statement which will check if the user has add his own logo into the images folder if he doesn't then the name of the blog will appear as normal text in place of the graphic logo. This is how it looks like: <?php $logo_dir = get_template_directory_uri() . "/images/logo.png"; if (file_exists($logo_dir)) { ?> <li><img src="<?php bloginfo ('template_directory'); ?>/images/logo.png" alt="<?php bloginfo('description'); ?>" /></li> <?php } else { ?> <li id='blog_name'><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?><font>*</font></a></li> <?php } ?> I've echo'd out $logo_dir, the URL is correct, but still for some reason it's seeing it as if there would no file exist. If I turn it around into !file_exists then the graphic logo WILL show up. So it's always seeing it as non-existent. Any ideas why this could be or am I using this function in a wrong fashion? As far as I've understood the PHP manual, this is the correct way of using it. Hi all ! The following code has two similar queries. Query 1 and Query 2. While Query 1 works just fine, Query 2 simply fails persistently. I have not been able to figure out why?
I have checked every single variable and field names but found no discrepancy of any sort or any mismatch of spelling with the fields in the database.
I would be grateful if anybody can point out what is preventing the second query from returning a valid mysqli object as the first one does. Here is the code for the two.
<?php $db_host = "localhost"; $db_user ="root"; $db_pass =""; $db_database ="allscores"; //////////////// CHECKING VARIABLE FILEDS IN A UPDATE QUERY ////////////////////////////////// //////////////// QUERY 1 ///////////////////////////////////////////////////////////////////// /* $db_database ="test"; $db_table ="users"; $RecNo = 1; $field1 = 'name'; $field2 = 'password'; $field3 = 'email'; $field4 = 'id'; $val1 = "Ajay"; $val2 = "howzatt"; $val3 = "me@mymail.com"; $con = mysqli_connect($db_host,$db_user,$db_pass,$db_database) or die('Unable to establish a DB connection'); $query = "UPDATE $db_table SET $field1 = ?, $field2 = ?, $field3 = ? WHERE $field4 = ? "; // session terminated by setting the sessionstatus as 1 $stmt = $con->prepare($query); var_dump($stmt); $stmt->bind_param('sssi',$val1,$val2,$val3,$RecNo); if($stmt->execute()) { $count = $stmt->affected_rows; echo $count; } //////////////// QUERY 1 END ///////////////////////////////////////////////////////////////////// */ //////////////// QUERY 2 ///////////////////////////////////////////////////////////////////// $con = mysqli_connect($db_host,$db_user,$db_pass,$db_database) or die('Unable to establish a DB connection'); $table = 'scores'; $date = date('Y-m-d H:i:s'); /* $prestr = "Mrt_M_"; $STATUS = $prestr."Status"; $S_R1 = $prestr."Scr_1"; $S_R2 = $prestr."Scr_2"; $PCT = $prestr."PPT"; $DPM = $prestr."DSP"; $TIMETAKEN = $prestr."TimeTaken"; */ $STATUS = "Mrt_M_Status"; $S_R1 = "Mrt_M_Scr_1"; $S_R2 = "Mrt_M_Scr_2"; $PPT = "Mrt_M_PPT"; $DSP = "Mrt_M_DSP"; $TIMETAKEN = "Mrt_M_TimeTaken"; $TimeOfLogin = $date; $no_of_logins = 10; $time_of_nLogin = $date; $m_scr_row1 = 5; $m_scr_row2 = 5; $m_ppt = 20; $m_dsp = 60; $m_time = 120; $date = $date; $RecNo = 24; $query = "UPDATE $table SET TimeOfLogin = ?, no_of_logins = ?, time_of_nLogin = ?, $S_R1 = ?, $S_R2 = ?, $PPT = ?, $DSP = ?, $TIMETAKEN = ?, $STATUS = '1', TimeOfLogout = ?, WHERE RecNo = ?"; $stmt = $con->prepare($query); var_dump($stmt); $stmt->bind_param('sisiiddssi',$TimeOfLogin,$no_of_logins,$time_of_nLogin,$m_scr_row1 $m_scr_row2,$m_ppt,$m_dsp,$m_time,$date,$RecNo); if($stmt->execute()) echo " DONE !"; ?>Thanks to all Code: [Select] <?php # This script does get included into the document create_new_tag_from.php if(isset($_POST['tag_name_submit'])){ $tag_name_submit = $_POST['tag_name_submit']; } if(!empty($_POST['tag_name'])){ $tag_name = strip_tags($_POST['tag_name']); } if(!empty($_POST['tag_description'])){ $tag_description = strip_tags($_POST['tag_description']); } if(isset($tag_name_submit)){ # The Validation of User Entered Data # Do validate for solely alphabetic characters with ctype_alpha # ctype_alpha($tag_name) && if(ctype_alpha($tag_description)){ $tag_name = strtolower($tag_name); $tag_description = strtolower($tag_description); # The Insertion Into the Database $db_connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); # Do research if SQL query has to be modified into a PHP comform query $sql_query = sprintf( "set @newid = convert( ( select max(convert( (substring(tag_id, 2)) , unsigned integer))+1 from tags), char(10) ); set @newid = if(length(@newid) = 1, concat('0', @newid), @newid); set @newid = concat('c', @newid); INSERT INTO tags (tag_id, tag_name, tag_description, added_by_user_id, creation_date, last_edited) VALUES (@newid, '%s', '%s', 7, now(), '0')", mysqli_real_escape_string($db_connect, $tag_name), mysqli_real_escape_string($db_connect, $tag_description) ); $sql_query_run = mysqli_multi_query($db_connect, $sql_query); # Print Test to See If It Works echo "works_ "; echo $tag_name . "_ "; echo $tag_description . "_ "; } else { # End of the Validation echo "The entered data must be in alphabetic characters."; } } ?> Here is the form: Code: [Select] <?php include_once('../../header.php'); include_once('../../model/contribution/create_new_tag_script.php'); ?> <form action="" method="post"> <input type="text" name="tag_name" value="" /> <textarea maxlength="60" type="text" name="tag_description" value=""></textarea> <input type="submit" name="tag_name_submit" value="Submit the New Tag" /> </form> <?php include_once('../../footer.php'); ?> By the script as given above the conditional check will skip to the error message. Though I have to say that ctype_alpha does return TRUE when I do try it with "tag_name" which is entered data from the input field, while the other is from the textarea. I simply cannot see the reason for the returned FALSE. How can I check if a function has returned false.. I know theirs the following way: if (!checkdate($month, $day, $year)) { //the function has returned false } But is their another way (beside using the ! operator) perhaps === FALSE (not sure if that'd work so asking)? I tried parsing through first https://www.jadaliyya.com/Details/28167/The-Empire-of-Sexuality-An-Interview-with-Joseph-Massad then even tried www.google.com and on both I get the following returned
post_url equals: www.google.compost_title equals: testpost_Threadybody equals: Enter your posts... URL equals: www.google.com www.google.com is not a valid URL Web page redirects after 2 seconds. And here is the if statement that handles my filter for URLs if(isset($_POST["submit"]) && !empty($_POST["url"]) && !empty($_POST["Title"])){ $URL = $conn -> real_escape_string($_POST["url"]) ; $BodyText = $conn -> real_escape_string(nl2br($_POST["ThreadBody"])) ; echo "<P>URL equals: " ; echo $URL ; echo "<P>" ; //Change to embed for youtube. if (filter_var($URL, FILTER_VALIDATE_URL)) { echo("$URL is a valid URL"); //Check if url is a youtube url if (strpos($URL,'youtube') !== false) { echo 'Youtube exists.'; $URL = preg_replace("/\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i","<iframe width=\"420\" height=\"315\" src=\"//www.youtube.com/embed/$1\" frameborder=\"0\" allowfullscreen></iframe>",$URL); } else { echo 'Youtube is not included .'; $URL = "<ahref ='" . $URL . "</a>" ; } $Title = $conn -> real_escape_string($_POST["Title"]) ; $User = $_SESSION['username']; $sql = "INSERT INTO Threads (Title, Users, ThreadBody, url) VALUES ('$Title', '$User','$BodyText','$URL')"; if (mysqli_query($conn, $sql)) { echo "New record has been added successfully !"; } else { echo "Error: " . $sql . ":-" . mysqli_error($conn); } } else { echo("$URL is not a valid URL"); }
Hello , this is my first post in this forum , i would like to see the following code and tell me your opinion , not about the security issues not about how good or bad it is. Its just a simple demonstration in order to show you the problem.
<?php include('config/functions.php'); $mysqli = connectionToDb(); $mysqli->autocommit(FALSE); $stmt = $mysqli->prepare("INSERT INTO users (first_name,last_name) VALUES ('stelios','stelios2')"); $stmt->execute(); $stmt->close(); $stmt = $mysqli->prepare("INSERT INTO users (first_name,last_name) VALUES ('stelios3','stelios4')"); $stmt->execute(); $stmt->close(); var_dump($mysqli->commit()); $mysqli->close();This is the code and the var_dump($mysqli->commit()); line prints false ! BUT , the inserts are in the database. If i comment out the commit line , then nothing is in the database. Can you advise ? Thanks ! in my code below the **data is extracted correctly for the first foreach but doesn't return anything for 2nd foreach though selected one present inside the 2nd foreach** i still get the error Warning: Invalid argument supplied for foreach() for line `foreach ($authorlist as $post)`... however the 2nd foreach returns data correctly as soon as i remove the first foreach loop. Everything about the email is sending except the message text does anyone know what the issue could be? here is the block of code that sends the email Thanks in advance Code: [Select] $image = "http://www.visualrealityink.com/dev/clients/arzan/snell_form/images/email.png"; echo "got to process form"; $target_path = "upload/"; $path = $target_path = $target_path . basename( $_FILES['file']['name']); $boundary = '-----=' . md5( uniqid ( rand() ) ); $message .= "Content-Type: application/msword; name=\"my attachment\"\n"; $message .= "Content-Transfer-Encoding: base64\n"; $message .= "Content-Disposition: attachment; filename=\"$path\"\n\n"; echo $path; $fp = fopen($path, 'r'); do //we loop until there is no data left { $data = fread($fp, 8192); if (strlen($data) == 0) break; $content .= $data; } while (true); $content_encode = chunk_split(base64_encode($content)); $message .= $content_encode . "\n"; $message .= "--" . $boundary . "\n"; $message .= $image . "<br />" . $_POST['name'] . "submitted a resume on our website. Please review the applications and contact the candidate if their resume is a fit for any open opportunities with the company. <br><br> Thank you. <br><br> SEI Team"; $headers = "From: \"Me\"<me@example.com>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\""; mail('george@visualrealityink.com', 'Email with attachment from PHP', $headers, $message); Hi guys, I have a problem with the $header variable. I am trying to extract the value from the $name method and included with the $email method. <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $name = clean($_GET['name']); $email = clean($_GET['email']); $type = clean($_GET['type']); $comments = clean($_GET['comments']); if($name == ''){ $errmsg_arr[] = 'name are missing.'; $errflag = true; } elseif($email == ''){ $errmsg_arr[] = 'email are missing.'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['name'])) { $insert[] = 'name = \'' . clean($_GET['name']) .'\''; } if(isset($_GET['email'])) { $insert[] = 'email = \'' . clean($_GET['email']) . '\''; } if(isset($_GET['type'])) { $insert[] = 'type = \'' . clean($_GET['type']) . '\''; } if(isset($_GET['comments'])) { $insert[] = 'comments = \'' . clean($_GET['comments']) . '\''; } if (count($insert)>0) { $names = implode(',',$insert); if(isset($email)){ $name = $_GET['name']; $email = $_GET['email']; $header = 'From: $name <-f $email>' . "\r\n"; $to = "myname@myemail.com"; $subject = $type; $message = "$comments"; $header .= "MIME-Version: 1.0\l\n"; mail($to, $subject, $message, $header); echo "Thank you for sent us your email"; } } } ?> Something got to do with this line: $header = 'From: $name <-f $email>' . "\r\n"; My problem is I can see in my email that the sender name has been included with (unknown sender) while the email address are display as empty address. I am really not sure why I have got the blank sender name and with the blank sender address. Do you know what the main problem is and what I need to change it with? Any advice would be much appreciate. Thanks, Mark Hey folks, I made a small shopping cart but I struggle with receiving an email with the orders; thanks in advance this is the mail.php <?php session_start(); if($_POST['sendemail'] == 'Email') { $headers = 'From: Sender <andrej13@gmail.com>'; mail('andrej13@gmail.com', 'Subject', $_SESSION["cart"], $headers); echo "DEBdsUG".$_POST["cart"]; echo 'Your mail has been sent'; } else { echo 'Your mail was not sent'; } ?> this is the cart.php <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions require_once('inc/functions.inc.php'); // Start the session session_start(); // Process actions $cart = $_SESSION['cart']; $action = $_GET['action']; switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=>$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i<=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PHP Shopping Cart Demo &#0183; Cart</title> <link rel="stylesheet" href="css/styles.css" /> </head> <body> <div id="shoppingcart"> <h1>Your Shopping Cart</h1> <?php echo writeShoppingCart(); ?> </div> <div id="contents"> <h1>Please check quantities...</h1> <?php echo showCart(); ?> <p><a href="index.php">Back to bookshop...</a></p> <form action="mail.php" method="post"> <input type="submit" name="sendemail" value="Email" /> <input type="hidden" name="cart" value="<?= $cart; ?>" /> </form> </div> </body> </html> Please would somebody be able to show me or give me some tips as to how I go about getting an email to send in my php code? $headers = 'From: me@me.com' . "\r\n" . 'Reply-To: me@me.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $first = $_GET['first']; $last = $_GET['last']; $town = $_GET['town']; $telephone = $_GET['telephone']; $code = $_GET['postcode']; $shortcode = substr($code,0,2); $query =mysql_query ("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3"); echo mysql_error(); echo "<p>The email addresses you have requested are;</p>"; while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; echo "$nt[0]<br>$nt[1]<br>$nt[2]<br>"; $message = "$first . $last, from $town has searched for your details.<br>You may contact them on $telephone. <br> Thankyou."; $subject = "You Showed Up In The Tree Directory!"; $email = "$nt[0],$nt[1],$nt[2]"; $to = "$email"; mail( "$to", "$subject","$message", "$headers"); ?></body></html> Hello Im making html mail for my project. However the mail() function of PHP does not send my email. Code: [Select] <?php $message = ' <html> <head> <title>Test Email</title> </head> <body> <h4>This is a test email message from me</h4> <br/> <p><b>Lorem Ipsum<b><br/> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> </body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: me <darkstarnexus@yahoo.com>' . "\r\n"; $headers .= 'From: Sample <sample@mail.com>' . "\r\n"; $headers .= 'Cc: Sample2 <sample2@mail>' . "\r\n"; $headers .= 'Bcc: sample3@mail' . "\r\n"; if(mail('darkstarnexus@yahoo.com', 'Test Html Email', $message, $headers)){ echo "mail delivered"; }else{echo "mail is not delivered";} ?> Can some tell me why? When I test my php, all of the errors work, but when I actually want to send an email the form doesnt go through and I get the error message 'Please enter a valid e-mail address'? I think I may have something wrong in my mail function. Code: [Select] <?php if (empty($_POST['author'])) { $errors[] = 'Please enter a name'; } if (empty($_POST['subject'])) { $errors[] = 'Please enter a subject'; } if (empty($_POST['text'])) { $errors[] = 'Please enter your comments.'; } if (empty($_POST['email'])) { $errors[] = 'Please enter an e-mail'; } else if (!preg_match("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$ ^", $_POST['email'])) { $errors[] = 'Please enter a valid e-mail address'; } if (count($errors) == 0) { // Process form mail("solysol05@gmail.com","Subject: subject", text,"From: author <email>"); echo "Thank you for using our mail form.<br/>"; echo "Your email has been sent."; } else { echo $errors[0]; } ?> Say I have an email info@website.com created in cPanel on a web hosting company. I want to send email notifications to users on my website. I am using PHP Mailer to send the emails. But all the emails go directly into their junk box/spam folder, unless they confirm that info@website.com is not junk. I am wondering if there is a work around for this? Okay, below is my mailer for a contact form i created. On one site it works fine. I even have it sending to several addresses from the othersite. However this site it doesnt want to work. PHP5 and mail() function is active. <?php $Name = Trim(stripslashes($_POST['fullname'])); $EmailFrom = Trim(stripslashes($_POST['email'])); $EmailTo = "james@jd-creations.co.uk"; $Subject = Trim(stripslashes($_POST['subject'])); $answer = Trim(stripslashes($_POST['answer'])); $Comments = Trim(stripslashes($_POST['message'])); $Subject = "The Reason - Contact Us"; // validation $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (Trim($answer)!=="20") $validationOK=false; if (Trim($Name)=="") $validationOK=false; if (Trim($Comments)=="") $validationOK=false; if (Trim($Subject)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=../contact/error2.php\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $EmailFrom; $Body .= "\n"; $Body .= "Comments: "; $Body .= $Comments; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=../contact/sent.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=../contact/error.php\">"; } ?> now i know it is wroking because it takes me to the sent.php page. not error.php i think it worked once. now not at all. Hi Everyone, I am trying to send email with the mail() function as per instructions at: http://php.net/manual/en/function.mail.php without success. The mail sends but when it arrives it doesn't render properly, I see all of the html tags with the data that's sent. My code is below: Code: [Select] <?php function processFormData($array, $form) { $errors = NULL; $message = NULL; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = "From: <chuck@deneb-consulting.com>" . "\r\n"; $headers .="Cc: <tinwakr@bell.net>" . "\r\n"; $headers .= "Reply-to: <chuck@deneb-consulting.com>" . "\r\n"; $headers .= "X-Mailer: PHP/" .phpversion() . "\r\n"; foreach($array as $key => $value) { //if any of the form values are empty catch them and add to error array if(empty($value) && $key != 'submit') { //build error list $errors .= '"' . str_replace('_', ' ', $key) . '" is a required field!<br />'; } else if(!empty($value) && $key != 'submit') { //capture values and insert them into a session variable $_SESSION[$key] = $value; } } if(empty($errors)) { $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\r\n"; $message .= '<html><head><title>' . $form .'</title></head>' . "\r\n" . '<body><table border="1">' . "\r\n"; foreach($array as $key => $value) { //regular expression check for phone number if(str_replace('_', ' ', $key) == 'Phone Number' && !preg_match("/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i", $value)) { return 'Please enter a valid phone number!'; } //regular expression check for email if(str_replace('_', ' ', $key) == 'Email Address' && !preg_match("/^[A-Z0-9._%-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i", $value)) { return 'Please enter a valid email address!'; } if($key != 'submit') { $message .= '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>' . "\r\n"; } } $message .= '</table></body></html>' . "\r\n"; mail("chuck@deneb-consulting.com", $form, str_replace("_", " ", $message), $headers); return 'Thank you, someone will contact you shortly.'; } else { return $errors; } } ?> Thanks in advance for all replies, Chuck |