0

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
sergio_101
  • 43
  • 7
  • You may want to check out http://stackoverflow.com/questions/1006650/dummy-smtp-server-for-testing-apps-that-send-email – uzyn Jul 23 '12 at 13:38
  • I use my http://www.dereuromark.de/2012/03/30/introducing-the-emaillib/ to send emails in productive mode and only log them away for development mode (debug > 0) – mark Jul 23 '12 at 15:13

1 Answers1

2

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.

Ross
  • 18,117
  • 7
  • 44
  • 64
  • ooops! i just saw this.. i think my only issue with this is that mail sending is scattered through the app.. i would rather have it set in a config somewhere. – sergio_101 Nov 07 '12 at 20:52