Posts: 17
Name: Ali Shan
Location: Pakistan, Lahore
|
Hey everyone!
I am trying to send email from my site with php it's is working but i want use my email noreply@mysite.com but it is not working please help me.
i am using this code
PHP Code:
<?php if (isset($_POST["submit"])) { include("data.php"); $Name=$_POST['Name']; $E_Mail=$_POST['E_Mail']; $Ph=$_POST['Ph']; $Ga=$_POST['Ga']; $Comments=$_POST['Comments']; $head=false; // E_val $M_er = false; // Ph_val $P_er = false; //Check $error = true; //Msg $sub = "No reply"; $msg = "$Name Thank you for our feed back."; if ($Name == '' || $E_Mail == '' || $Ph == '' || $Comments == '') { echo '<div id="container"><div style="position:absolute;left:500px;top:237px;width:768px;height:23px;z-index:10" align="left">Write your name.</div><div style="position:absolute;left:540px;top:335px;width:768px;height:23px;z-index:10" align="left">Your comments Please!</div></div>'; } if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $E_Mail)) { $M_er = false; } else{ $M_er = true; echo '<div id="container"><div style="position:absolute;left:500px;top:263px;width:768px;height:23px;z-index:10" align="left">Invalid Email address.</div></div>'; } if(preg_match("/^[+]{1}[0-9]{12}$/", $Ph)) { $P_er = false; } else{ $P_er = true; echo '<div id="container"><div style="position:absolute;left:500px;top:287px;width:768px;height:23px;z-index:10" align="left">Check format (+011231231234).</div></div>'; } if($M_er == false && $P_er == false){ $error = false; } if($error == false){ mysql_query("INSERT INTO `gmifamil_form`.`gmi` (Name, EMail, Ph, Ga, Comments) VALUES ('$Name', '$E_Mail', '$Ph', '$Ga', '$Comments')") or die(mysql_error()); ini_set('SMTP', "mail.mysite.com"); ini_set('smtp_port', '26'); ini_set('sendmail_from', "noreply@mysite.com"); mail($E_Mail,$sub,$msg); header("Location: Thank_you.htm"); } } ?>
Regards.
|