开发者

PHP mail function giving fatal error but mail is still sent

开发者 https://www.devze.com 2022-12-15 04:35 出处:网络
I have (what I think) is a simple script to send a short mail: <?php $to = \"test@test.co.uk\"; $subject = \"Amendment required\";

I have (what I think) is a simple script to send a short mail:

<?php

$to = "test@test.co.uk";

$subject = "Amendment required";
$message = "Employee: " . $_POST['employees'] . "<BR /><BR />Notes: " . $_POST['notes'] . "<BR /><BR />Reported By: " . $_POST['开发者_开发问答empID'] . ".";
$from = "amendments@test.co.uk";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $from";
mail($to,$subject,$message,$headers);

?>

(I've changed the email addresses for privacy reasons)

When this is loaded, after a delay we get the error

"Fatal error: Maximum execution time of 30 seconds exceeded..." - but the mail is sent successfully.

Am i missing something simple here?

Many thanks in advance

leddy


Sending a single E-Mail using mail should not take 30 seconds. Never. You should talk to the server administrator unless you are sending out mail to hundreds or thousands of recipients, or the E-Mail is dozens of megabytes big. It seems, though, that neither is the case. I would guess that the sendmail command PHP is calling internally is taking too long to respond for some reason.

Is this the full script you are executing?


Try using set_time_limit(0) to remove the PHP Execution time limit. It might not work properly if you have safe_mode on, but it should work otherwise.

0

精彩评论

暂无评论...
验证码 换一张
取 消