Question

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

Was it helpful?

Solution

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?

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top