PHP - I Want Send Scheduled Email. Please Help Me How Can Iwrite Code In Php
i want send scheduled email. please help me how can i write code in php
Similar TutorialsHi guys, I have a booking form on my website for potential customers to request a booking. The form asks for their Name, Address, Email and Tel No. I need the code to be able to send the form by Php. I also need it to show an error message if they haven't completed any of the fields. The fields on my form a Name, Address, District, City, Postcode, Tel No, Email. Please help. Hi FYI I'm a n00b in this particular forum & php n00b really but I'm having a problem & cant find a solution anywhere! I need to be able to send an email from a form. Within the form is a dropdown field for different regions. When a region is selected it sets the email address for that region into an input/text field. I need to pickup that value and send the email to that address but not sure how. Have been told to use echo$email & that perhaps my variable is empty but I haven't got a clue where to put it or what that means. Help please?! my code: include ('maketable.php'); include ('mailbot.php'); include ('auditFile.php'); $office = $_REQUEST["office"]; $callername = $_REQUEST["callername"]; $callerphone = $_REQUEST["callerphone"]; $callaction = $_REQUEST["callaction"]; $callerInfo = "Callers Name=".$callername; $commentInfo = "Callers Phone No=".$callerphone; $callDetail = "Action Taken=".$callaction; $title = "DOC Call Results"; $stylesheet = "stylesheet.css"; $logo = "tcclogo.jpg"; $display = makeHeader($title,$stylesheet,$logo); $display .= makeTable("Caller Details",$callerInfo,1); $display .= makeTable("",$commentInfo,1); $display .= makeTable("",$callDetail,1); $display .= '</body></html>'; $info = $callerInfo."; ".$commentInfo."; ".$callDetail; auditFile($title, $info); echo $email; mailbot($title,$display,"email","info@tcc.co.nz","ThankYou.html"); Hello every one i need your help please about this i would like to add this tabs to my facebook fan page i got App allowing me to put php coding or html but i need when some one add his info and click on submit i receive it at my email so can any 1 here help me or tell me what shall i do ? i newbie and hope to get your help guys please Hello, I am creating a website with the use of php and mysql. While I am not advanced, I've been learning quite a bit on php. However, I am looking to build a tracker type script and hide it into my coding so that if someone were to hack into my website and take my website coding, that it would send me an email notifying that they were using my coding. How would I go about this? If you can help me, i'd be glad to credit you! Thank you! Hello all, I used simple php email function but it send an email in junk folder or spam. Can anyone tell me why is this so? Her is the code: $host = "ssl://smtp.gmail.com"; $port = "465"; $to = " xx@gmail.com"; // note the comma $subject = " $_POST[company_website] "; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: About Wholesale Account' . "<$_POST[email]>\r\n"; $headers .= 'Cc: mail@gmail.com' . "\r\n"; $headers .= 'Bcc: cc@gmail.com' . "\r\n"; mail($to, $subject, $message, $headers); Hello Guys,
I need your help as many PHPers here is more experienced in PHP coding than me. I have specific project I am working on and need a piece of code that can send an email from HTML form using PHP to the email address that is entered manually on the form, instead of standard sent to PHP code that is fixed within PHP script and executed during submission. I want sth that can grab manually enetered recipient's e-mail address, paste it to the PHP code and then use it to send the email to the recipient, instead of fixed sent to code. Something would say dynamically changed during the entry that can inject into PHP code the new address email entered on the form and then submit to it. Any ideas will be great.
Thanks.
Edited March 27, 2019 by slawotrend
The code below currently sends a separate Email with data from each row of a table when a Save All button is pressed. So, if I have 4 rows of data, 4 Email will be sent. $email="to@email.com"; $from="from@email.com"; $msg=""; $subject="Registers Info for: ".$values["first_name"]." ".$values["last_name"].""; $msg.= "Student: ".$values["first_name"]." ".$values["last_name"]."\r\n"; $msg.= "Absent or Present: ".$values["attendance_status"]."\r\n"; $msg.= "Class: ".$values["classname"]."\r\n"; $msg.= "Class Date: ".$values["attendance_date"]."\r\n"; $msg.= "Amount Received: ".$values["cash_received"]."\r\n"; $msg.= "Paid For: ".$values["cash_whatfor"]."\r\n"; $ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from)); if(!$ret["Sent"]) echo $ret["message"];
Edited February 27, 2020 by leemo Hello, i have been looking for and answer on the internet but i couldn't find it! I'm new on PHP based on and example i wrote something like this for my website: //basic variables $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "example@mysite.org"; $Subject = "Registration u10"; $teamname = Trim(stripslashes($_POST['teamname'])); $affiliation = Trim(stripslashes($_POST['affiliation'])); $premier = Trim(stripslashes($_POST['premier'])); $challenge = Trim(stripslashes($_POST['challenge'])); $girls = Trim(stripslashes($_POST['girls'])); $boys = Trim(stripslashes($_POST['boys'])); //about 15 more variables go in here but i don't want to put them to save some space // validation $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // email body text //this includes the info of all the variables at the top even the ones I didn't write in here (but you get the point ) $Body = ""; $Body .= "Team Name: "; $Body .= $teamname; $Body .= "\n"; $Body .= "\n"; $Body .= "AYSleague: "; $Body .= $aysleague; $Body .= "\n"; $Body .= "\n"; $Body .= "Flash Tournament: "; $Body .= $flashtournament; $Body .= "\n"; $Body .= "\n"; $Body .= "Spring 2011: "; $Body .= $spring2011; $Body .= "\n"; $Body .= "\n"; $Body .= "Summer 2011: "; $Body .= $summer2011; $Body .= "\n"; $Body .= "\n"; $Body .= "fall 2011: "; $Body .= $fall2011; $Body .= "\n"; $Body .= "\n"; // send email to my inbox with the information above $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // if everything goes OK it will redirect them to another page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thanksu12.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">"; } ?> the problem that i have is: (i divided it in 2 sections) 1- i need to sent a second email to the coach 2- that email only needs to have the information of 6 variables not the whole thing I don't know how to do it, if someone knows how to do it, i will appreciate some help!! thanks! Hi I have a form that I want people to fill out and then click the button and it sends me an email. My problem is that it doesn't send me any emails, I have looked around and I don't seem to find any thing. This is my form in application_form.php Code: [Select] <form action="application_form" method="POST"> <table border="0" cellpadding="5" cellspacing="0"> <tr> <td>Full name</td> <td><input type="text" size="30" maxlength="80" name="name" /></td> </tr> <tr> <td>Email address</td> <td><input type="text" size="30" maxlength="80" name="email" /></td> </tr> <tr> <td>Message</td> <td><textarea name="message" cols="29" rows="5"></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Submit Message" /></td> </tr> </table> </form> and this is the php on the same application_form.php Code: [Select] <?php if (isset($_POST['submit'])) { // Collect variables $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; // Send email $body = "The following feedback has been submitted:\n\n"; $body .= "Name: $name\n"; $body .= "Email: $email\n"; $body .= "Message: $message"; mail ("cerberus478@gmail.com","Feedback Received",$body,"From: cerberus478@gmail.com"); // Output confirmation echo "<p>Your message has been received.</p>"; } ?> i wrote this code <?php $mail_to='XXX@gmail.com'; $subject_mail='UYYYY'; $message='XXXXX'; $headers = "MIME-Version: 1.0 \r\n"; $headers .= "Content-type: text/html; charset=UTF-8 \r\n"; $headers .= "From: XXX@gmail.com \r\n"; mail($mail_to, $subject_mail, $message, $headers ); ?> but the email will not send why please? Hello, I have a registration page and when a user registers I want to send their email an activation code. To test I have the following code. <?php //Send activation Email $to = $Email_address; $subject = "www.WEBSITE.com/"; $message = "Welcome to my website!\r\rYou, or someone using your email address, has completed registration at WEBSITE. You can complete registration by clicking the following link:\rhttp://www.WEBSITE.com/register.php?action=verify&$activationKey\r\r If this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ "; $headers = 'From: noreply@abc.com' . "\r\n" . 'Reply-To: noreply@abc.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); if (mail($to, $subject, $message, $headers)) { echo 'Success'; } else { echo 'Error'; } ?> I have the last if else to see if it is sent to not. I do get a Success message, but I don't get an email at the address (I have checked the spam folder). I have checked the email address and it is correct. I have even waited a few hours and nothing. Why is the email not getting to my account? Hi guys, i have a custom made php that collect all the info in admin page (long story short), there's a button called "Approve" I would like to send back an email to user who applied with picture, once Approved button is pressed, so here's the script: <?php session_start(); $user = '123'; $pass = '123'; $to = $data['email']; $subject = 'blablabla'; $message = 'test123'; if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $pass) { header('WWW-Authenticate: Basic realm="Enter password to access this page."'); header('HTTP/1.0 401 Unauthorized'); echo"You must be logged in to see this page."; exit; } ################## PROTECTED CONTENT ######################## require('./config.php'); ?> <!DOCTYPE HTML> <html> <head> <title>ADMIN PANEL</title> <style type="text/css"> body{width: 960px; margin: auto; margin-top: 20px; padding: 5px 20px; box-shadow: 0px 0px 2px #000000; border-radius: 5px;background:transparent url(images/bg_header.gif) top left repeat-x;} a:link,a:active,a:visited{color: inherit; text-decoration: none;} a:hover{text-decoration: underline;} .button{background:transparent url(images/grad.PNG) bottom left repeat-x; padding: 3px 5px; border-radius: 4px; border: 1px solid #cccccc;} .button:hover{border-color:orangered;text-decoration:none;} .approve .img{max-height: 200px; max-width: 200px; position: absolute; right: 5px; top: 5px;} .approve{display: block; height: 200px; overflow: hidden; box-shadow: 0px 0px 2px #000000; margin-top: 20px; padding: 20px; position: relative; font:13px verdana;} textarea,input{padding: 3px;font: 13px helvetica,verdana;border:1px solid rgb(51,151,251);border-radius: 4px;width: 300px; display: block; margin: 5px 0px;} input:hover,textarea:hover{border-color:orangered;cursor:pointer;} form{font:bold 13px verdana;} input[type='submit'],input[type='button']{width: auto;} </style> </head> <body> <?php echo" <div id='head'> <h1 align='center'>ADMIN PANEL</h1> <h4 align='center'><a href='index.php' class='button'>Homepage</a> <a class='button' href='admin.php'>Approval Queue</a> <a class='button' href='admin.php?edit'>Edit Image info.</a> <a class='button' href='?edit&view'>View Image Info.</a></h4> </div>"; if (isset($_GET['edit'])) { if (isset($_GET['pid'])) { $pic = mysql_query('SELECT * from `' . $table_name . '` WHERE pid = ' . intval($_GET['pid'])); if (mysql_num_rows($pic) == 1) { if (isset($_POST['submit'])) { $approved = isset($_POST['approved']) && $_POST['approved'] == '1' ? 1 : 0; mysql_query('UPDATE `' . $table_name . '` SET ' . 'first_name = "' . $_POST['first'] . '",' . 'last_name="' . $_POST['last'] . '",' . 'phone="' . $_POST['phone'] . '",' . 'email="' . $_POST['email'] . '",' . 'first_name="' . $_POST['first'] . '",' . 'approved=' . $approved . ',' . 'address="' . $_POST['addr'] . '",' . 'admin_desc="' . $_POST['admin_desc'] . '"' . ' WHERE pid = ' . intval($_GET['pid'])) or exit("Unable to edit" . mysql_error()); echo'<h3>EDITED</h3>'; $pic = mysql_query('SELECT * from `' . $table_name . '` WHERE pid = ' . intval($_GET['pid'])); } $data = mysql_fetch_array($pic); if (isset($_GET['view'])) { echo' <strong>Uploaded by </strong>' . $data['first_name'] . ' ' . $data['last_name'] . ' <br /> <img src="' . $default_dir . $data['image_name'] . '" style="max-width: 200px; max-height:200px; float: right;" /> <br /> <br /> <b>First_name :</b> ' . $data['first_name'] . ' <br /> <br /> <b>Last_name :</b> ' . $data['last_name'] . ' <br /> <br /> <b>Phone :</b> ' . $data['phone'] . ' <br /> <br /> <b>Email :</b> ' . $data['email'] . ' <br /> <br /> <b>Approved :</b> ' . ($data['approved'] == 1 ? 'Yes' : 'No') . ' <br /> <br /> <b>Address :</b> ' . $data['address'] . ' <br /> <br /> <b>Admin_description :</b> <br /> <br />' . $data['admin_desc'] . ' <br /> <br /> <a href="?edit&pid=' . $data['pid'] . '" class="button">Edit</a> <br /> <br /> '; } else { echo'<form method="POST" action="?edit&pid=' . intval($_GET['pid']) . '"> Editting photo: <a style="color:rgb(51,151,251);" href="' . $default_dir . $data['image_name'] . '">' . $data['image_name'] . '</a> uploaded by ' . $data['first_name'] . ' ' . $data['last_name'] . ' <br /> <img src="' . $default_dir . $data['image_name'] . '" style="max-width: 200px; max-height:200px; float: right;" /> <br /> First_name : <input type="text" name="first" value="' . $data['first_name'] . '" /> Last_name : <input type="text" name="last" value="' . $data['last_name'] . '" /> Phone : <input type="text" name="phone" value="' . $data['phone'] . '" /> Email : <input type="text" name="email" value="' . $data['email'] . '" /> Approved : <input type="text" name="approved" value="' . $data['approved'] . '" /> 0 or 1 Address : <textarea name="addr">' . $data['address'] . '</textarea> Admin_description : <textarea name="admin_desc">' . $data['admin_desc'] . '</textarea> <input type="submit" name="submit" value="Edit" /> </form>'; } } else { echo"NO SUCH PICTURE EXISTS"; } } else { echo" <h3>Search for image to " . (isset($_GET['view']) ? 'view' : 'edit') . " it: </h3> <form id='form' method='POST' action='admin.php?edit" . (isset($_GET['view']) ? '&view' : '') . "'> Uploader's first name: <input type='text' name='name' value='' /> OR Image name: <input type='text' name='img' value='' /> OR Email: <input type='text' name='email' value='' /> <input type='submit' name='submit' value='Search' /> </form>"; if (isset($_POST['submit'])) { $name = empty($_POST['name']) ? '%' : '%' . $_POST['name'] . '%'; $email = empty($_POST['email']) ? '%' : '%' . $_POST['email'] . '%'; $img = empty($_POST['img']) ? '%' : '%' . $_POST['img'] . '%'; $query = mysql_query( 'SELECT * from `' . $table_name . '` where ' . 'first_name like "' . $name . '" and ' . 'email like "' . $email . '" and ' . 'image_name like "' . $img . '"'); if (mysql_num_rows($query) > 0) { while ($pic = mysql_fetch_array($query)) { echo"<hr/><strong>Uploaded by $pic[first_name] $pic[last_name] " . date(' \a\t H:i \o\n d/m/Y', intval($pic['image_name'])) . "</strong> - <a href='$default_dir$pic[image_name]' target='_blank'>$pic[image_name]</a> <a href='?edit" . (isset($_GET['view']) ? '&view' : '') . "&pid=$pic[pid]' class='button'>" . (isset($_GET['view']) ? 'View' : 'Edit') . "</a>"; } } else { echo "NO IMAGE MATCHES THAT DESCRIPTION"; } } } exit; } if (isset($_GET['approve'])) { if (mysql_query('UPDATE `' . $table_name . '` SET approved = 1 WHERE pid = ' . intval($_GET['approve']))) { if (@mail($to, $subject, $message)) { echo('<p>Mail sent successfully.</p>'); } else { echo('<p>Mail could not be sent.</p>'); } echo"<h2>APPROVEDs</h2>"; } } It's not whole script though. Hi guys I am trying to send an HTML email using the following code, adapting some code I found on a tutorial site:- Code: [Select] <?php //define the receiver of the email $to = $email; //define the subject of the email $subject = 'Trade-Bidz Registration'; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with \r\n $headers = "From: registrations@trade-bidz.co.uk\r\nReply-To: registrations@trade-bidz.co.uk"; //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; //define the body of the message. ob_start(); //Turn on output buffering ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <h2>Hello World!</h2> <p>This is something with <b>HTML</b> formatting.</p> --PHP-alt-<?php echo $random_hash; ?>-- <? //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); //send the email $mail_sent = mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?> The code processes, but no email is received, any idea what I am doing wrong/missed out? I have a bit of php code that sends an email. I would like to add another email recipient to this code, so that the email is sent to BOTH the post author AND the following email address... help@dealfiles.com
Yes, this is part of a Wordpress plugin. It's a small part of a large plugin that I have a LOT of time investing in setting up, so I can't just look for an alternate plugin. I really need to get this one to work.
Thanks in advance for any and all help with this. Here is the existing code: <?php if (get_post_meta( $post->ID, '_listing_contact_form', true) != '') { echo do_shortcode(get_post_meta( $post->ID, '_listing_contact_form', true) ); } else { $nameError = ''; $emailError = ''; if(isset($_POST['submitted'])) { $url = get_permalink(); $listing = get_the_title(); if(trim($_POST['contactName']) === '') { $nameError = 'Please enter your name.'; $hasError = true; } else { $name = trim($_POST['contactName']); } if(trim($_POST['email']) === '') { $emailError = 'Please enter your email address.'; $hasError = true; } else if (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['email']))) { $emailError = 'You entered an invalid email address.'; $hasError = true; } else { $email = trim($_POST['email']); } $phone = trim($_POST['phone']); if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['comments'])); } else { $comments = trim($_POST['comments']); } if(!isset($hasError)) { $emailTo = get_the_author_meta( 'user_email', $post->post_author ); if (!isset($emailTo) || ($emailTo == '') ){ $emailTo = get_option('admin_email'); } $subject = 'Listing Inquiry from '.$name; $body = "Name: $name \n\nEmail: $email \n\nPhone: $phone \n\nListing: $listing \n\nURL: $url \n\nComments: $comments"; $headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; wp_mail($emailTo, $subject, $body, $headers); $emailSent = true; } } ?> i have the following which sends an email whenever a post is made within the topic the user is subscribed to. However it still sends the email to the person who made the reply. I need to take out the email of the poster if they are in the notification list. This is what i have but it doesnt seem to remove them. $notification_query = $db->query("SELECT u.user_id, u.user_email, u.user_username, n.notification_user_id FROM ".DB_PREFIX."members as u LEFT JOIN ".DB_PREFIX."notifications as n ON n.notification_user_id = u.user_id WHERE n.notification_topic_id = '$post_id'") or trigger_error("SQL", E_USER_ERROR); $num_rows = mysql_num_rows($notification_query); while ($notification_list = mysql_fetch_object($notification_query)) { $users4[] = $notification_list->user_email; } $emailAddress = implode(', ', $users4); if (in_array($_SESSION['user_username'], $emailAddress)) { $emailAddress = str_replace($_SESSION['user_username'], ' ', $emailAddress); } if ($num_rows >=1) { putenv('TZ=EST5EDT'); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: no-reply@thevault.0sites.net' . "\r\n"; $message .= "A Reply Has Been Made To {$_POST['subject']}.<br /><br />"; $message .= "You are receiving this message because you have subscribed to the topic {$_POST['subject']},<br /> which has a new post since your last one.<br />"; $message .= "Click the link below to view the new thread now.<br />"; $message .= "<a href=\"{$site_root}/index.php?forum={$forum_id}\"> {$site_root}/index.php?forum={$forum_id}&topic={$thread_topic_id}</a><br /> <br />To Unsubscribe from this topic visit the link below.<br /><br /> <a href=\"{$site_root}/subscribe.php?forum={$forum_id}&topic={$topic_id}&uid={$notification_list->user_id}&do=unsubscribe\"> {$site_root}/subscribe.php?forum={$forum_id}&topic={$topic_id}&uid={$notification_list->user_id}&do=unsubscribe</a><br /><br /> Thanks"; $subject = "A Reply Has Been Made To {$_POST['subject']}."; mail($emailAddress,$subject,$message,$headers); } } guys, in the code below (this is just a demonstration) i need to find out once a card payment has been done, the code changes the status of the order but it doesnt send email. can u please help me find out why? <?php session_start(); include ("includes/db.php"); include ("includes/function.php"); //authentication if (loggedin()==FALSE) { Header("Location: login.php"); exit(); } //username session $_SESSION['username']=='$username'; $username=$_SESSION['username']; echo "Welcome, " .$_SESSION['username']."!<p>"; //get user id $getdetails=mysql_query("SELECT * FROM users WHERE username='$username'"); while($row = mysql_fetch_array($getdetails)) { $users_id=$row['id']; $email=$row['email']; } $getdetails=mysql_query("SELECT * FROM booking WHERE users_id='$users_id' AND status='pending'"); $totaloforders=mysql_num_rows($getdetails); while($row = mysql_fetch_array($getdetails)) { $users_id=$row['id']; $bookedtime=$row['time']; $bookeddate=$row['date']; $bookedseat=$row['seat_no']; echo " <td>Swinging For Seat: $bookedseat on $bookeddate at $bookedtime</td><br/> "; echo "</table>"; } //get the firstname $myfirstname=$_SESSION ['firstname']; //get the lastname $mylastname=$_SESSION ['lastname']; //get the email $myemail=$_SESSION ['email']; //get the seat number $myseatnumber=$_SESSION ['seatnumber']; //get the booking time $mytime=$_SESSION ['time']; //get the booking date $mybookingdate=$_SESSION ['datetime']; //get the ride id $ride=$_SESSION ['ride']; //get the bookings $select=mysql_query("SELECT * FROM booking WHERE users_id='$users_id'"); while ($row=mysql_fetch_array($select)){ $id=$row['id']; $date=$row['$date']; $time=$row['time']; } /////////////////////////////////////////////////////////////////////////////////////////////// // Calculate the price plus VAT, VAT at current time is 20% of each service $price=mysql_query("SELECT price FROM ride_type WHERE id='$ride'"); while ($row=mysql_fetch_array($price)){ $rideprice=$row['price']; } $net=$totaloforders*$rideprice; $vat=$net*20/100; $finalprice=$net+$vat; ////////////////////////////////////////////////////////////////////////////////////////////// if ($_POST['pay']) { /** Validation */ $cardNo = addslashes(strip_tags($_POST['cardNo'])); $cc = addslashes(strip_tags($_POST['cc'])); $expire = addslashes(strip_tags($_POST['expire'])); if ($cardNo == "" ||$cc == "" || $expire == "" ) { echo "Please insert full credit card details"; } else { function luhnCheck($cardNo) { $cardNo = str_replace(" ", "", trim($cardNo)); if(!is_numeric($cardNo) or strlen($cardNo)>19) return false; $skip = $newNum = $total = 0; for($i=0;$i<=(strlen($cardNo)-1);$i++) { if($skip ==0) { $tmpNum = ($cardNo[$i]*2); $total += (strlen($tmpNum)==2 ? (substr($tmpNum, 0, 1)+substr($tmpNum, 1)) : $tmpNum); $skip = 1; }else{ $total += $cardNo[$i]; $skip = 0; } } return (($total % 10) == 0); } /* Example Usage */ if(luhnCheck) { $updatebooking=mysql_query("UPDATE booking SET status='completed' WHERE users_id='$users_id' AND date='$bookeddate' AND time='$bookedtime' AND status='pending'"); $select=mysql_query("SELECT * FROM booking WHERE ride_id='1' AND users_id='$users_id' AND seat_no='$bookedseat' AND status='completed'"); while($row=mysql_fetch_array($select)) { $donetime=$row['time']; $donedate=$row['date']; $doneseat=$row['seat_no']; } $to = $email; $subject = "Your Ticket"; $headers = "From: mina@minashirazi.com"; $body = "Hello $username,\n\n <table> Please find the tickets you have booked. <td>Swinging For Seat: $doneseat on $donedate at $donetime</td> </table>"; } else { echo"There was an error updating your details"; } // echo("Valid Number."); //}else{ // echo("Invalid Number."); } } ?> <html> <head> </head> <body> <form name="confirm" method="post" action=""> <p> First Name:<br /> <input type="text" name='firstname' value="<? echo "$myfirstname";?>"> <p> Last Name:<br /> <input type="text" name='lastname' value="<? echo "$mylastname";?>"> <p> Email:<br /> <input type="text" name='email' value="<? echo "$myemail";?>"> <p> Net Price :<br /> <? echo "$rideprice"; ?> pounds<p> VAT :<br /> <? echo "$vat"; ?> pounds<p> Total :<br /> <? echo "$finalprice"; ?> pounds<p> Card No:<br/> <input type="text" name="cardNo"> <p>CCV:<br/> <input type="text" name="cc"> <p>Expiry Date<br/> <input type="text" name="expire" value="e.g 12/10"> <p> <input type="submit" name="pay" value="Pay Now"> </form> </body> Hi I have a following code, validation part and jquery works perfectly in the code but it dosent send the email
I have jquery.js file in the head section of html and it work perfectly
contact.php
<div id="emailcontainer"> <div id="ack"> </div> <div id="emailsend"><img src="images/emailsend.gif"></img><br> <p>We will get back to you soon</p></div> <form id="contactform"> <div> <label for="name">NAME:</label> <input type="text" name="name" id="name" placeholder="John Doe" /> </div> <div> <label for="email">EMAIL:</label> <input type="text" name="email" id="email" placeholder="JohnDoe@example.com" /> </div> <div> <label for="comment">MESSAGE:</label> <textarea name="comment" rows="10" cols="50" id="comment"></textarea> </div> <input type="submit" name="submit" value="SEND" id="submit" /> </form> </div><!---div emailcontainer end here---> </div><!---div main end here--->this page does the validation part from php test.php <?php if(isset($_POST["submit"])) { $errors = array(); $name = $_POST['name']; $email = $_POST['email']; $comment = $_POST['comment']; $to = "reboosttechnologies@gmail.com"; $from = $_POST['email']; $headers = "From: $from"; $flag = false; $success = mail($to,$comment,$headers); $emailReg = '/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/ '; if(!($name) || !($email) || !($comment)){ if(!$name){ $errors[]="Missing Name"; } if(!$email){ $errors[]="Missing Email"; } if(!$comment){ $errors[]="Missing Comment"; } $json_response = json_encode($errors); }elseif(!preg_match($emailReg,$email)){ $errors[] = "Not a valid email address"; $json_response = json_encode($errors); }elseif($success){ $flag = true; return $flag;}else{ $json_response = json_encode("Thanks for your comment"); } echo $json_response; } ?>this file does the jquery validation without page refresh function.js $(function(){ $("#emailsend").hide(); $("#submit").click(function(event) { event.preventDefault(); var emailReg = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/; var errors = false; var name = $('[name=name]').val(); var email = $('[name=email]').val(); var comment = $('[name=comment]').val(); $('.errors').remove(); if($("#name").val() == ""){ $("#name").after("<span class= 'errors'> Missing Name </span>"); errors = true; } if($("#email").val() == ""){ $("#email").after("<span class= 'errors'> Missing Email </span>"); errors = true; }else if(!emailReg.test($('#email').val())){ $("#email").after("<span class= 'errors'> Not valid Email </span>"); errors = true; } if($("#comment").val() == ""){ $("#comment").after("<span class= 'errors'> Missing Comment </span>"); errors = true; } if(errors == true) { return false; } else { input_data = { "name" : name, "email" : email, "comment": comment, "submit" : true } $.ajax({ type: 'post', url: 'test.php', data: input_data, dataType: 'json', success: function( msg ) { $("#ack").html(msg); $("#contactform").delay(500).slideUp(500); $("#emailsend").show(700); }, error: function() { $("#ack").html('ERROR!'); } }); } }); }); Okay, I got the other parts of this script to input the form information into my database, but this part of the code is not sending the user the activation email. Please Help!? I've attached the complete script for an extra pair of eyes. Thanks /!!!!!!!!!!!!!!!!!!!!!!!!! Email User the activation link !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $myemail = "admin@knirv.com"; $emess = "First Name: $firstname\n"; $emess.= "Last Name: $lastname\n"; $emess.= "Email 1: $email1\n"; $emess.= "Email 2: $email2\n"; $emess.= "City: $city\nState: $state\nZip/Post Code:$zip\n"; $emess.= "Country: $scountry\n"; $emess.= "Phone number 1: $phone1\n"; $emess.= "Phone number 2: $phone2\n"; $emess.= "Phone number 3: $phone3\n"; $emess.= "Comments: $sendmail"; $ehead = "From: $myemail\r\n"; $subj = "Complete knirv.com registration!"; $mailsend=mail("$myemail","$subj","$emess","$ehead"); //Begin HTML Email Message $message = "Hi $firstname, Complete this step to activate your login identity at knirv.com. Click the line below to activate when ready. http://www.knirv.com/activation.php?id=$id&sequence=$db_password If the URL above is not an active link, please copy and paste it into your browser address bar Login after successful activation using your: E-mail Address: $email Password: $password See you on the site! admin@knirv.com"; //end of message unset($_GET['do']); header("Location: thank_you.php"); break; } $msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $firstname, one last step to verify your email identity:</h4><br /> In a moment you will be sent an Activation link to your email address.<br /><br /> <br /> <strong><font color=\"#990000\">VERY IMPORTANT:</font></strong> If you check your email with your host providers default email application, there may be issues with seeing the email contents. If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br /> "; include_once 'msgToUser.php'; exit(); } Hi, would like to know if there is any way to send email using localhost? is it possible and how can i do it? |