문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top