Reputation: 85
Whenever I'm doing development on a site which sends emails to users I have to remember to comment out the mail() code so that I don't accidentally trigger the notification email whilst fiddling around and debugging, it's a pain and occasionally I forget and send emails to people when I didn't mean to.
is there a way to enforce a whitelist at the php.ini level (or some other low level) of email addresses that mail() is allowed to send too?
Do other people have clever ways of avoiding this issue?
Upvotes: 3
Views: 404
Reputation: 92752
Not at that level, but there are various workarounds:
Upvotes: 0
Reputation: 36619
Why not have a maintenance mode
setting for your site?
if ($maintenance_mode) {
// only send mail to admin
} else {
// send mail to users
}
Upvotes: 0
Reputation: 163272
I would do this at the SMTP level. Configure it there and have PHP use a specific SMTP server that is only for development.
Upvotes: 3