Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My sendmail.php is taking too long to send the mail, here too long i mean to say that it takes 3 to 4 hrs also, and mostly when submitting the form the mail do not get sent too.

Is there any way to add some code which can help in posting the mail instant or something i am missing in the code needs to be modified.

Hoping for a quick response...

What I have tried:

if(isset($_REQUEST['button']))
{
$user_name= $_POST['name'];
$email_id= $_POST['email_id'];
$phone= $_POST['phone'];

$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "user";
$password = "pass";

$to="someid@gmail.com";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";
$headers .= "From: <".'myid@abc.com'.">" ;

$subject = "My Subject";

$value=mail($to,$subject,"Name:$user_name

Email:$email_id

Message:$phone",$headers);
if($value==1)
{echo "<script>
alert('Mail Submited Successfully')</script>";
header("Location:https:myurlredirect");
}
else{
echo "<script>
alert('Mail not submited')</script>";
}
}
?>



Posted
Updated 1-Jul-16 22:44pm
Comments
Richard MacCutchan 1-Jul-16 6:55am    
3 to 4 hours? That does not sound like a coding problem, more likely something wrong with your internet.

1 solution

test your inbox(time) with another email (make one email and send mail again and check the time) again
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900