Is it possible to turn off email sending in cakephp development mode?

713 Views Asked by At

While in development mode, it's not necessary to send emails (and can be spammy for the most part). We would like to be able to see the generate email in the log, but perform no email deliveries.

When the site is running in production mode, we would want to send deliveries as usual.

is this possible in a config file somewhere?

1

There are 1 best solutions below

1
Ross On

you could do something as simple as:

if(Configure::read('debug')==0) {
   // send the email
} 

// log the email has been sent
// etc

and this will only send the email if you are in production (assuming using Cake's default debug levels - 0, 1, 2 but this might create a lot of extra work. The question in uzyn's comment looks like a more robust solution.