开发者

Rails 2.3 action mailer Net::SMTPFatalError

I am sending out a confirmation email on save. When an email address in the 'CC' list is invalid I get the following error

Net::SMTPFatalError (550 5.1.1 ... User unknown ):

and the transaction is not saved even though it is called from the after_save method in the model observer. Should'nt the transaction be saved before the error.

Also, when I set the raise_delivery_errors to false in my config f开发者_如何学JAVAile, the error is not raised and the transaction is saved but the email is not sent to the members of the 'To' list and the 'CC' list even if one of the email addresses in the 'CC' list is invalid.

The system should atleast send emails to people with valid email addresses. Any suggessions to fix this issue.

thanks, ash


Sorry, your callbacks run in the context of the transaction, and returning false or throwing an exception causes the transaction to rollback: http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html

Can you catch that exception in your code, log it, and not re-raise it?

You could use your after_save to fire a worker queue or delayed job.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜