Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mail will not send from Windows Server 2008

I have two servers. One (linux) will send mail fine using the script below. The second (windows server 2008) sends nothing.

<?php mail ( "[email protected]", "Contact Us Form", "This is an email from your site", "From: [email protected]" )
?>
like image 403
Michael Avatar asked Mar 30 '26 18:03

Michael


1 Answers

mail() works very different on linux and windows.

  • On Linux it pipes your mail to the sendmail binary, which does all the work
  • On windows it actually needs to act as an MTA to pass the mail off to another application.

On windows your best bet is to set the SMTP information so PHP can hand off the mail to another server which will take care of final delivery.

https://www.php.net/manual/en/mail.configuration.php#ini.smtp

That done (and your webserver restarted to allow the change to take affect) if you're still unable to send mail check the logs for both PHP and the specified MTA to see where things are breaking down.

like image 88
preinheimer Avatar answered Apr 02 '26 13:04

preinheimer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!