How to test PHP send mail on local server with MAMP Pro
Asked Answered
W

1

6

I have a small web form that on submission triggers a mail script that sends an email to the address given to verify their email address.

I want to test this on my local server using MAMP Pro. I am totally confused from the info I have sourced that holds different advice and requirements.

I use Dreamweaver (DW) with WebAssist (WA) extensions to build my PHP scripts and when I contacted WA support to ask how to enter the correct settings with their DW plugin to work with MAMP pro they told me..

To have your localhost send email you need to install a local SMTP server configured for email relay.

If you want to use a remote smtp server you would likely have to use the PEAR mail option for authentication.

This has thrown me as I can't see anywhere in any MAMP Pro documentation about having to install SMTP servers and I know nothing about PEARL.

The following Blog makes it sound simple..

http://blog-en.mamp.info/2009/09/how-to-sending-emails-with-mamp-pro.html

But it obviously isn't as I have tried these Postfix settings with know joy.

I have also seen this post..

Test emails locally with mamp

..that gives a method using gmail but I just can't make sense of it as It appears that the MAMP interface may have changed since this was written.

Plus I am not familiar with using Terminal.

If anyone can shed some light on this to point me in the right direction I would be most greatfull

Windowlight answered 1/9, 2017 at 9:54 Comment(3)
I use an app call test Mail Server Tool (toolheap.com/test-mail-server-tool) start it up, send emails --- easyWheen
Thanks @jeff I'll check it out.Windowlight
Sorry @jeff I should have made it clearer. I am working on a Mac, your suggestion is a windows application.Windowlight
I
7

You can use Mailhog to achieve this. I wrote a tutorial on Medium.

Install mailhog using Homebrew (if you don't have Homebrew installed, check out the instructions here: https://brew.sh/):

brew install mailhog

Open MAMP Pro and go to the “Postfix” tab. Make sure the checkbox next to “Include Postfix service in GroupStart” is checked. Use these setting for Postfix:

  1. Fill in your domain name in the field “Set domain of outgoing e-mails to:”
  2. Check “Use a Smart host for routing”
  3. “Server name:” is 127.0.0.1:1025 (this is the SMTP port Mailhog uses)
  4. Set “Authentication” to “none”

Go to http://127.0.0.1:8025/ in your browser to see the mails sent by PHP.

Inspan answered 12/10, 2017 at 11:47 Comment(3)
Thanks for this @janhenkes. Will check it out when I get the timeWindowlight
@huykon225, you need to start mailhog via: brew services start mailhogPhotothermic
Here's an updated way to configure Mailhog with MampPro. gist.github.com/jaredatch/2574941e8ff480942f82a1a4c22f0678Disassemble

© 2022 - 2024 — McMap. All rights reserved.