且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Sendmail.php发送邮件需要太长时间......?

更新时间:2023-02-22 21:02:52

_REQUEST ['button']))

{


user_name =


_POST ['name'];


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>";
}
}
?>



_REQUEST['button']))
{


user_name=


_POST['name'];