# How to I test actionmailer for failed delivery

**URL:** <https://www.ruby-forum.com/t/how-to-i-test-actionmailer-for-failed-delivery/139330>\
**Category:** Rails\
**Created:** [June 2, 2008, 11:36pm UTC](https://www.ruby-forum.com/t/how-to-i-test-actionmailer-for-failed-delivery/139330 "2008-06-02T23:36:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![procyon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@procyon](https://www.ruby-forum.com/u/procyon)\
**Post date:** [June 2, 2008, 11:36pm UTC](https://www.ruby-forum.com/t/how-to-i-test-actionmailer-for-failed-delivery/139330/1 "2008-06-02T23:36:09Z")

</div>

I want to simulate a scenario where email sent using actionmailer has  
failed. How do I induce mail delivery error in my tests ?

eg:

begin  
UserNotify.deliver\_signup(@user, params[‘user’][‘password’], url)  
rescue  
puts “user confirmation email error”  
\<…other code … \>  
end

I need to verify that user\_confirmation\_email\_error is printed when  
deliver\_\* method throws an exception
