本文介绍了Sendmail.php发送邮件需要太长时间......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我的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 [email protected]; $ headers =MIME-Version:1.0 \\\\ n; $ headers。=Content-type:text / html; charset = UTF-8 \\\\ n ; $ headers。=From:<。'[email protected]'。> ; $ 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>; } } ?> 解决方案 user_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="[email protected]";$headers = "MIME-Version: 1.0\r\n";$headers .= "Content-type: text/html; charset=UTF-8\r\n";$headers .= "From: <".'[email protected]'.">" ;$subject = "My Subject";$value=mail($to,$subject,"Name:$user_nameEmail:$email_idMessage:$phone",$headers);if($value==1){echo "<script>alert('Mail Submited Successfully')</script>";header("Location:https:myurlredirect");}else{echo "<script>alert('Mail not submited')</script>";}}?> 解决方案 这篇关于Sendmail.php发送邮件需要太长时间......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-28 15:09