I have been developing a Web app with the MAMP solution stack (v2.0.5), which includes:
- Mac OS X (v10.7.3)
- Apache v2.2.21
- MySQL v5.5.9
- PHP v5.3.6
I have been using the PHP mail() function to send an activation URL to newly registered user accounts:
$body = "Thank you for registering. To active your account, please click on this link:\n\n";
$body .= BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a" . "&z=$bs";
mail($trimmed['email'], 'Registration Confirmation', $body, 'From: admin@tester.com');
However, it seems that after a while… this has just stopped, and now I fail to receive any of these these messages to my tester user accounts.
My php.ini file is at: /Applications/MAMP/bin/php/php5.3.6/conf/php.ini
With the default settings:
[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 =
It used to work perfectly until recently and has now failed. I haven’t intentionally changed any settings that I am aware of that may have caused this to stop.
After much Googling and reading it seems you have to set up your SMTP server in order to send emails from your localhost to another email address for it to work at all, but I am very positive that it did used to work, I received emails… honestly!
I hope someone can help. Many thanks.
UPDATED-SOLVED:
Basically sorted it. Started trying to use PEAR and the Mail plugin, but found it horrible. Ended up using an external SMTP server and PHPMailer, much better.
Useful Info:
http://www.askapache.com/php/phpfreaks-eric-rosebrocks-phpmailer-tutorial.html
https://orangsetya.wordpress.com/2007/09/12/send-mail-using-smtp-authentication-phpmailer-script
Basically sorted it. Started trying to use PEAR and the Mail plugin, but found it horrible. Ended up using an external SMTP server and PHPMailer, much better.
Useful Info: http://www.askapache.com/php/phpfreaks-eric-rosebrocks-phpmailer-tutorial.html https://orangsetya.wordpress.com/2007/09/12/send-mail-using-smtp-authentication-phpmailer-script
Cheers.