mail is not sending in php, giving Unexpected token W -
i'm sending mail using mail() function,but mail not going,this giving "unexpected token w" error..what problem,here code: 1 me solve issue....i'm sending mail using mail() function,but mail not going,this giving "unexpected token w" error..what problem,here code:...i'm sending mail using mail() function,but mail not going,this giving "unexpected token w" error..what problem,here code: 1 me solve issue....
index.php: <form name="" action="contact.php" method="post" class="wpcf7-form" novalidate> <div style="display: none;"> <input type="hidden" name="_wpcf7" value="5" /> <input type="hidden" name="_wpcf7_version" value="4.1" /> <input type="hidden" name="_wpcf7_locale" value="en_us" /> <input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f5-p12-o1" /> <input type="hidden" name="_wpnonce" value="aa14dbded6" /> </div> <div class="wpcf7-response-output wpcf7-display-none"></div> <div class="row"> <div class="col-sm-6"> <div class="form-field"> <label for="your-name">your name <span>*</span></label> <span class="wpcf7-form-control-wrap your-name"> <input type="text" name="name" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" id="your-name" aria-required="true" aria-invalid="false" /> </span> </div> <div class="form-field"> <label for="your-email">your email <span>*</span></label> <span class="wpcf7-form-control-wrap your-email"> <input type="email" name="email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" id="your-email" aria-required="true" aria-invalid="false" /> </span> </div> <div class="form-field"> <label for="your-phone">your phone</label> <span class="wpcf7-form-control-wrap your-phone"> <input type="tel" name="phone" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-tel wpcf7-validates-as-tel" id="your-phone" aria-invalid="false" /> </span> </div> </div> <div class="col-sm-6"> <div class="form-field"> <label for="your-subject">subject</label> <span class="wpcf7-form-control-wrap your-subject"> <input type="text" name="subject" value="" size="40" class="wpcf7-form-control wpcf7-text" id="your-subject" aria-invalid="false" /> </span> </div> <div class="form-field"> <label for="your-message">message <span>*</span></label> <span class="wpcf7-form-control-wrap your-message"> <textarea name="message" cols="40" rows="10" class="wpcf7-form-control wpcf7-textarea wpcf7-validates-as-required" id="your-message" aria-required="true" aria-invalid="false"></textarea> </span> </div> <div class="form-field"> <input type="submit" value="send message" name="submit" class="wpcf7-form-control wpcf7-submit c-button" /> </div> </div> </div> </form> contact.php: <?php $to = "arundsti@gmail.com"; $subject = 'a new enquiry on diamondshine'; $name = $_request['name']; $email = $_request['email']; $phone = $_request['phone']; $subject=$_request['subject']; $date = date("y/m/d"); $comments = $_request['message']; if(isset($_post['submit'])) { $message = '<img src=\imagedental\'><br><br><br><b>name</b>: ' .$name.'<br><br><b>email</b>: ' .$email.'<br><br><b>phone</b>: ' .$subject.'<br><br><b>subject</b>: ' .$phone.'<br><br><b>messsage</b>: ' .$comments.'<br><br><b>date</b>: '.$date; // send html mail, content-type header must set $headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; // additional headers //$headers .= 'to: mary <mary@example.com>, kelly <kelly@example.com>' . "\r\n"; $headers .= 'from: diamondshine '.$email . "\r\n"; //$headers .= 'cc: birthdayarchive@example.com' . "\r\n"; //$headers .= 'bcc: birthdaycheck@example.com' . "\r\n"; $sent = mail($to, $subject, $message, $headers) ; if($sent) { ?> <script type="text/javascript"> alert('thanks contacting us. in touch shortly...'); location.href = "contactus.php"; </script> <?php } else {print "we encountered error sending mail"; } } ?>
your code working fine confirm whether have configured sendmail on server
Comments
Post a Comment