Sendmail.php发送邮件需要太长时间......? [英] Sendmail.php takes too long to send the mail...?

查看:77
本文介绍了Sendmail.php发送邮件需要太长时间......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的sendmail.php花了太长时间发送邮件,这里太久了我的意思是说需要3到4小时,而且大多数情况下提交表单时邮件也不会被发送。



有没有办法添加一些可以帮助发布邮件的代码,或者我需要修改代码中缺少的东西。



希望得到快速回复...



我尝试过:



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;

$密码=通过;



$ to =someid@gmail.com;

$ headers =MIME-Version:1.0 \\\\ n;

$ headers。=Content-type:text / html; charset = UTF-8 \\\\ n ;

$ headers。=From:<。'myid@abc.com'。> ;



$ subject =我的主题;



$ value = mail($ to,$主题,名称:$ user_name

电子邮件:$ email_id

消息:$ phone,$ header);

if($ value == 1)

{echo< script>

alert('Mail Submited Successfully')< / script>;

header(Location: https:myurlredirect);

}

else {

echo< script>

alert('邮件未提交')< / script>;

}

}

?>



解决方案

_REQUEST ['button']))

{


< blockquote> 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'];


这篇关于Sendmail.php发送邮件需要太长时间......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆