Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm doing web development with PHP on my mac and need to be able to use the mail command locally (on localhost). What do I have to configure to get the PHP mail() command working?

PS: On Windows I used hmail for this.


I mean how to connect PHP with mail server on my mac, i noticed when i type mail on terminal, it seems mac already come with Mail Server.

share|improve this question
1  
Depending on what you want to do with it you may be able to use the mail server included in OSX. Can you give some details about intended use? –  patrix Oct 29 '11 at 11:04
    
Im going to use that for my localhost only. Im php webdeveloper. so i need mail server to handle PHP mail() :) –  GusDeCooL Oct 29 '11 at 11:22
add comment

2 Answers 2

up vote 2 down vote accepted

This works for me at OS X Snow Leopard:

  • When an email is sent using PHP's mail() function, the email is piped through to the smtp_catcher.php script.
  • The smtp_catcher.php script saves the email into a local folder as a .emlx file.
  • The email is opened through Apple Mail and displayed on the screen (woo!).
share|improve this answer
add comment

Yeah you will need to install a PHP server on your machine like apache (http://www.apache.org/dyn/closer.cgi) or maybe wamp (windows only)(http://www.wampserver.com/en/).

Unlike HTML, JAVASCRIPT, CSS etc. PHP is a server side programming language (aka scripting language), meaning it compiles on the server, not the browser, and that you need to run a server to compile it.

Once you have the server running, make a .PHP file and put it in the 'site' folder, from there it will run :D

share|improve this answer
    
i already install PHP (MAMP). Please see my question, i update it to make it more clear. –  GusDeCooL Nov 4 '11 at 15:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.