Send mail from localhost with PHP with MAMP

半城伤御伤魂 提交于 2019-12-04 14:31:48

The solution on this post finally worked for me. http://www.blog.tripleroi.com/2012/05/solvedenabling-sendmail-on-localhost.html

Correct setting in php.ini:

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

; For Win32 only.
;sendmail_from = don@tripleroi.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path =/usr/sbin/sendmail -t -i -f  yourname@example.com

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.

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.

MAMP PRO already has this, and has a simple interface to do this, I got it and I have it working perfectly. http://www.mamp.info/en/mamp-pro/

In my case the problem was in empty /etc/postafix/main.cf

cat /etc/postafix/main.cf

shows nothing. But there was not empty main.cf~orig So I've hust copied contents from main.cf~orig:

sudo cp main.cf~orig main.cf

After that MAMP starts sending mails.

Set 'from' in mail.php config file.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!