Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should ActionMailer raise_delivery_errors be true or false in production?

If true it will send an error message to the user. If false delivery errors wont be noticed.

What's the recommended way to handle this?

like image 347
dwaynemac Avatar asked Jan 23 '23 06:01

dwaynemac


1 Answers

We just put an app in production, and our ISP's mail server frequently returns "451 spool busy" errors when we try to send mail.

Neither answer was good for us: if we return an error to the user, we're passing on our infrastructure problem to them; if we don't, they don't get their invitation/confirmation/notification/whatever, and no one knows why.

Instead, we decided to set up delayed_job, and always send mail through it; it retries automatically, and we can see (from the job queue table in the database) if messages are piling up. (It was really simple to set up, too - the hardest part was making sure that the worker thread was running, and that was a simple addition to our Monit configuration.)

(Bonus: here's an initializer I wrote to delay mail in production, but still send it directly in development and test: http://gist.github.com/178125)

like image 95
Bryan Stearns Avatar answered Jan 26 '23 05:01

Bryan Stearns