Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
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

Yeah you will need to install a PHP server on your machine like apache ( or maybe wamp (windows only)(

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

Your Answer


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.