Here's a weird one.
I've been happily sending form data in emails with PHP for some time, but it's stopped working. I don't know when exactly it stopped; I've only just noticed! (It could be weeks ago.) I've run through the config and it seems that everything is OK. However, even scripts that used to work now throw up a "Server error" whenever the mail() function is called.
I've tried two machines and environments, both running Win2K Server with IIS5:
- My public machine runs PHP 4.0.6 on IIS5 with Microsoft's IIS Lockdown tool activated
- My development machine runs 4.2.3 without the lockdown tool
Both have the problem.
The php.ini files are in my C:\WINNT folders, and the configuration is the same in both. I'm with Pipex broadband in the UK, and these values have worked in the past. They're the same as in my email client:
SMTP = smtp.dsl.pipex.com
sendmail_from = mejxxx@dsl.pipex.com
Here's the code I'm using to call the function:
$to = "me@myisp.co.uk";
$subject = "website feedback form";
$message = "Hello world\n";
mail("Ben<$to>", $subject, $message, "From: website<feedback@mywebsite.com>\nReply-To: $form_email_name<$form_email_field>") or ($result = 0);
Can anyone suggest where I'm going wrong? Is this just a bug in the Windows implementation of mail()? If so, what am I doing wrong?
In reality, my message is a lot longer than that one, but ultimately it's just simple text with a few \n newlines in. It has worked in the past.
Thanks to anyone who can help.