Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send mail from localhost with PHP with MAMP

Tags:

php

email

mamp

I've been trying everything I can find on the internet for this, and none of them seem to be working, so I'm doing something wrong and I need some help figuring out what.

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]

The above code is what I have changed everything to, (except for the email is my actual email (also I'm not sure if yahoo email will work with this or not, so maybe that's the problem?)) I am not sure where the sendmail_path goes to, I cannot find that path anywhere (am I suppose to download some file/program called sendmail?)

also, my APACHE port I have changed to 80, and my MySQL port is 3306, (I don't know if those ports have anything to do with the smpt_port or not)

Any help would be greatly appreciated, thanks!

(if there are any other ways, (easier ways) of doing this, please also let me know).

like image 310
Dylan Cross Avatar asked Oct 08 '22 00:10

Dylan Cross


2 Answers

The solution on this post finally worked for me. https://tripleroi.com/solvedenabling-sendmail-on-localhost-for-mamp-free-version/

Correct setting in php.ini:

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path =/usr/sbin/sendmail -t -i -f  [email protected]

You have to make sure to comment out the Win32 settings. After doing that, my MAMP server on my Mac finally got a mail through.

like image 62
Federico Avatar answered Oct 13 '22 12:10

Federico


I used to have an array of problems like this including the email one when I was still using MAMP.

MAMP Pro should fix it all, but I recommend just doing an install of apache/php/mysql yourself. You'll have no more problems with basic stuff like this and it's a free solution.

If you're on OSX apache is already there, php can be installed via homebrew. Mysql can just be downloaded from the official site as an installer.

like image 36
bottleboot Avatar answered Oct 13 '22 12:10

bottleboot