I think the best way to check this is by just trying to send an email via php mail()
command, that way you can test if it works without having to worry if the problem is in your code. I think the problem is rather how or if php works with sendmail.
In my php.ini in Mamp/conf/php5.6.6, I have made the following changes:
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
sendmail_path =/usr/sbin/sendmail -t -i -f mymail@example.com