How To Send Emails Via MAMP for Mac OS Localhost

One advantage of self hosted wordpress over the free blogger platform that’s rarely mentioned is the ability to design and test the functionality of an entire site before uploading it online. To do that we use free softwares like XAMP and WAMP for Windows and MAMP for Mac OS.

Testing out certain features of your site that require sending emails doesn’t work offline ‘cause by default you can’t send emails on localhost via the free version of MAMP but with a little tweak of the php configuration file, that is now possible.

For this to work, you must have an email address hosted on a server of your own. CPanel based servers seem to be a lot easier to navigate. To create an email address do please read How To Setup A Self-Hosted Email Address Via CPanel and take note of your SMTP server. Generally for example if your domain is www.thatshot.com, your smtp server and port will be mail.thatshot.com with port 25

Also I tested this on Mac OS X Mavericks 10.9.4

Simple launch MAMP then go Preferences >>> PHP and take note of the PHP version you’re currently running

 

MAMP for MAC Panel Setup

Screen Shot 2014-07-20 at 9.39.35 PM

 

Navigate to Applications\MAMP\conf folder and look for the folder that corresponds to your php version and open the php.ini file contained within with a text editor. Scroll down to the section that says [mail function]. It should look like what appears below

 

Screen Shot 2014-07-20 at 9.55.46 PM

 

Change the parts circled in red below using the appropriate email address and smtp hosted on your server.

 

Screen Shot 2014-07-20 at 10.08.03 PM

 

Save and exit the modified php.ini file and launch Terminal

In Terminal, type in or copy and paste this: sudo mkdir -p /Library/Server/Mail/Data/spool and hit enter. Provide your admin’s password when prompted then copy and paste the code in this file into the terminal window and hit enter again.

Stop and start MAMP servers again and test the email function again. It should be working just fine now.

Hope this works for you as easily as it did for me. Note that there was some delay when sending some emails. Don’t know the reason why though.

Enjoy

Source 1 et Source 2

Reviewer's Rating!
Leave Your Own Rating!
[Total: 3 Average: 3]

You’ll also like:

  1. How To View MAMP Localhost On Mobile Devices
  2. Fix MAMP Apache MySQL Server Not Starting On Mac OS X Yosemite
  3. How To Setup A Self-Hosted Email Address Via CPanel
  4. How To Fix Hostgator Wordpress Emails Being Tagged As Spam
  5. How To Setup Hostgator Self Hosted CDN For W3 Total Cache

Please share this article to help others. Thanks