First thing first, i'm totally new to this kind of localhost server setup and i've been spending the last couple of days trying to figure this out, but with no luck.
I'm developing a php website with an email form.
I'm on a MAC using codekit and MAMP FREE and everything works fine. Now my question is, is it possible to test the email that should be sent from the form locally?
I've tried a lot of examples, like uncommenting the [mail function]
bit in php.ini
file, installing 3rd parties app like fakeSMTP and MockSMTP but absolutely nothing worked. The mailto()
code should work, as when i debug it no error are thrown
Is it possible to do that or not? anyone who knows how to properly set this up or that can point me to a dumb-proof guide?
Ok, if someone is interested in this, i finally found a way to make it work.
I'm gonna explain it here in a detailed step-to-step tutorial.
Requirements
Step-by-step tutorial
gmail.com
as domain for outgoing emails and then click the button "Use this data"
After this is done, you want to open the terminal and type in
sudo nano /System/Library/LaunchDaemons/org.postfix.master.plist
(this will allow you to edit the org.postfix.master.plist file otherwise not editable.
The only edit that you want to do is adding at the top, right after <dict>
, this line <key>Disabled</key>
Now close the terminal and restart your mac.
NB: It is important that you use a working account for the
to
section of themail()
function, otherwise you won't be able to test the emails!
status:sent
. This status sent means that the email has been sent and that the local test worked as expectedWhat's next?
to
section in your mail()
functionI'm using it, and it is actually working nicely.
Quick tip
After this, I made a couple of adjustment in my gmail inbox, adding an alias and a filter. I'm gonna explain this as well as it may be useful for a beginner
[myemailaddress][email protected]
)[myemailaddress][email protected]
That's it! hope this is clear enough and that it will help some of you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With