javascript - Error during sending mail in Local xampp server -
javascript - Error during sending mail in Local xampp server -
when submitting php contact form in local xampp server showing 'we unable send email due technical problems. please seek again.' pls help how prepare error..
here php code
<?php session_start(); ini_set("display_errors",'0');//display errors if($_post['submit']) { $key=substr($_session['key'],0,5); //echo "key---------->".$key; $number = $_request['number']; //echo "number---------->".$number; if($number!=$key) { $error="<left><font color=\"red\"><b>invalid come in code !</b></font></left>"; } else { $to = "test@gmail.com"; $html_msg = ' <html> <head> <title>test services enquiry form</title> </head> <body> <table width="0%" align="center" cellpadding="5" cellspacing="0" style="border:2px solid #2964b0;"> <tr> <td colspan="3" align="center" bgcolor="#2763af"><font color="#ffffff" size="3" face="arial, helvetica, sans-serif"><strong>test services enquiry form</strong></font></td> </tr> <tr> <td align="right"><font size=2 color=322147 face=arial, helvetica, sans-serif><b>name</b></font></td> <td><strong><font size=2 color=#2d557f face=verdena>:</font></strong></td> <td><font size=2 color=#000000 face=verdena>'.$_post['txtname'].'</font></td> </tr> <tr> <td align="right"><font size=2 color=322147 face=arial, helvetica, sans-serif><b>mobile</b></font></td> <td><strong><font size=2 color=#2d557f face=verdena>:</font></strong></td> <td><font size=2 color=#000000 face=verdena>'.$_post['txtphone'].'</font></td> </tr> <tr> <td align="right"><font size=2 color=322147 face=arial, helvetica, sans-serif><b>email</b></font></td> <td><strong><font size=2 color=#2d557f face=verdena>:</font></strong></td> <td><font size=2 color=#000000 face=verdena>'.$_post['txtemail'].'</font></td> </tr> <tr> <td align="right"><font size=2 color=322147 face=arial, helvetica, sans-serif><b>gross income</b></font></td> <td><strong><font size=2 color=#2d557f face=verdena>:</font></strong></td> <td><font size=2 color=#000000 face=verdena>'.$_post['txtincome'].'</font></td> </tr> </table> </body> </html>'; ini_set ("sendmail_from", "test@gmail.com"); ini_set("smtp","localhost"); $subject="test services form : ".$_post['txtname']; $headers = 'mime-version: 1.0' . "\r\n"; $headers .= "content-type: text/html; charset=utf-8\r\n "; $message .="content-transfer-encoding: 7bit \r\n"; $message=$html_msg; $mailsent= mail($to,$subject,$message,$headers); if($mailsent) { /*header("location:thanks.html");*/ echo "<script language=javascript>;window.location=\"index.php\";alert(\"thanks filling form. in touch soon. \");</script>"; /* $msg="<font color='#e7b376'>thanks submitting our booking form. <br>one of our representatives in touch soon.</font>";*/ } else { $msg="<span style='color:red;'>we unable send email due technical problems. please seek again.</span>"; } } } ?>
you have configure php.ini smtp info of e-mail.
see tutorial at: http://planetghost.com/send-emails-localhost-xampp-wamp-php
don't forget restart server after changes.
javascript php jquery html css
Comments
Post a Comment