1

We just migrated our PHP 5.2 / IIS 8 website to a new server.

We are unable to use the MAIL function.

mail($to, $subject, $message, $headers);

that returns:

the 500 error

  1. How do I enable detailed error messages?
  2. is there something I need to install to get the mail function to work?
Alex Gordon
  • 51,480
  • 273
  • 609
  • 976

2 Answers2

3

By default PHP uses sendmail, You need to configure your PHP setting to use a SMTP server on windows.

The link below will get you started...

http://geekswithblogs.net/tkokke/archive/2009/05/31/sending-email-from-php-on-windows-using-iis.aspx

Jay Bhatt
  • 5,376
  • 3
  • 32
  • 57
  • Ideally you'll want to use the SMTP server of your hosting provider or ISP. Running your own SMTP server is much more of a pain in the ass than you might think. – Sammitch Mar 05 '13 at 18:32
1

500 is a permanent smtp error and therefore there is either a problem with the configuration of the mail server or the recipient of the email.

If you telnet to the server on port 25 and issue the following commands;

helo localhost
mail from:<your.email.address>
rcpt to:<recipient.email.address>
data

ctrl c

What happens?

ChrisBint
  • 12,532
  • 5
  • 34
  • 56