php - Test emails locally with mamp -


first thing first, i'm totally new kind of localhost server setup , i've been spending last couple of days trying figure out, no luck.

i'm developing php website email form.

i'm on mac using codekit , mamp free , works fine. question is, possible test email should sent form locally?

i've tried lot of examples, uncommenting [mail function] bit in php.ini file, installing 3rd parties app fakesmtp , mocksmtp absolutely nothing worked. mailto() code should work, when debug no error thrown

is possible or not? knows how set or can point me dumb-proof guide?

ok, if interested in this, found way make work.

i'm gonna explain here in detailed step-to-step tutorial.

requirements

  • mamp pro
  • working gmail account cause need login email account inbox (i made work using gmail, not sure others)

step-by-step tutorial

  • first thing first, need install mamp pro. in postfix tab, add gmail.com domain outgoing emails , click button "use data"
  • after done, want open terminal , type in sudo nano /system/library/launchdaemons/org.postfix.master.plist (this allow edit org.postfix.master.plist file otherwise not editable.

  • the edit want adding @ top, right after <dict>, line <key>disabled</key>

  • now close terminal , restart mac.

  • after restart, open mamp , go website want test emails , submit email.

nb: important use working account to section of mail() function, otherwise won't able test emails!

  • nothing happens in front end, if open mamp -> postfix tab, @ botto can see path of log file , arrow, click on arrow , display log message.
  • scroll down till last line, should find saying status:sent. status sent means email has been sent , local test worked expected

what's next?

  • ok, login gmail account (the 1 used to section in mail() function
  • go spam , should see email sent local machine.

i'm using it, , working nicely.

quick tip

after this, made couple of adjustment in gmail inbox, adding alias , filter. i'm gonna explain may useful beginner

  • login gmail account pc
  • go top right cog icon , go settings
  • in accounts , import, add account use alias (in case [myemailaddress]+test@gmail.com)
  • once done, go filters tab
  • add new filter , set affect emails [myemailaddress]+test@gmail.com
  • click continue go next screen
  • now, here can tweak prefer, but important thing check never send spam able see emails you'd test. (my personal setup skip inbox (archive) , add specific label)

that's it! hope clear enough , of you.


Comments