php mail function does not work on Mac

I am having a very strange issue with mail function in php.

  1. I have configured postfix and when executed from command like email message is sent. For example this works: echo "Hello" | mail -s "Test" my@me.com
  2. I can send email from command like using php no problem. For example this works: php -r "mail('test@gmail.com', 'test', 'test')"'

but when trying to send mail with php code from apache from inside of php web page it does not even attempt to send email. If I check the mail.log, I see it does not even record anything into log file.



Feels like something prevents apache from sending email.



Please advise me how to fix this issue on Mac?



Thank you!

Replies

None of that has anything to do with OS X or iOS app development. In fact the forum you posted it in is for discussions about the Apple developer forums themselves.


Anyway for such general questions about LAMP type server side tools you'll have to go to a different forum such as stackoverflow. These forums are narrowly focused on Apple's tools (Xcode) and APIs, not third party open source stuff.

I see. I posted here because other sections were definetely less relevant.


My code works on Linux but I cannot get the mail() function run on Mac Yosemite. It works from the command like but not from the Apache web server... Searched Stackoverflow all over and did post a message there now as well.


Thank you!

Still hoping that somebody here knows what the problem is and can advise me.

Linux is the problem. Use an established and supported OS.

Do you need a hug today Robert? 😀


Nothing at all wrong with Linux, particularly for server side stuff. I believe his question is about using typical server technologies on OS X, which as you know is also a Unix based OS. It's a perfectly reasonable question; it can be done (OS X even includes Apache and PHP out of the box) but this forum is not the best place to ask about it since it's not related to Xcode or the Apple SDKs.