I have a PHP script running on a Windows web server, running PHP 5.
The script works fine when I send to an email that is NOT on the domain, but when I try and send to an email that IS on the domain, I get a 500 internal server error. Here's code that fails, assuming the website is www.mydomain.com
<?php
ini_set('sendmail_from', 'dan@mydomain.com');
mail('anything@mydomain.com', 'Test', 'This is a test');
?>
If I change the to field to anything@someotherdomain.com, it works fine. Removing or modifying the ini_set does nothing.
I've checked a few PHP ini settings but can't see any reason it'd fail for just this one domain.