views:

798

answers:

2

Hi, I've been working on a rails app that uses the restful authentication plugin. It requires a new user to activate their account through email verification. This has been working up until a few hours ago, when the application suddenly started to fail on email delivery. Instead I am greeted with the following error message:

 undefined method `perform_delivery_SMTP' for #<UserMailer:0x28ec7ac>

I've reverted to an old revision, created new apps with actionmailer, reinstalled rails, reinstalled all plugins and gems but the error persists. Has anyone ever seen this error before? It would seem I need to add the perform_delivery_SMTP method to the UserMailer model, but how and why? Thanks.

+3  A: 

Where do you configure your mailer?

I am guessing that your delivery method is set like this

ActionMailer::Base.delivery_method 'SMTP'

Use :smtp instead of 'SMTP'

ActionMailer assumes you will use :smtp, :sendmail or :test

It uses that in the deliver! method like so

__send__("perform_delivery_#{delivery_method}", mail) if perform_deliveries

which means that when delivery_method is set to 'SMTP' it will try to call perform_delivery_SMTP, which doesn't exist as you found out. When you use the symbol :smtp it calls perform_delivery_smtp, which does exist.

BaroqueBobcat
Thank you! This fixed the problem instantly. You're a life saver.
William
Nice catch. I had no idea :P
Toby Hede
A: 

Those who have been struggling with ActionMailer working fine on local server (development mode) and not working in production mode should consider following link:

http://filiptepper.com/2009/02/11/hint-fixing-smtp%5Ftlsrb-for-ruby-187/

It solved my problem, might be helpful for others too. Basically the problem is that “check_auth_args in Net::SMTP takes different arguments in Ruby 1.8.7 (which I’m using for development) and in Ruby 1.8.6 (staging)”. And the worst thing is that it does not leave an error in the production.log file. To verify that it really was the problem I had to run ActionMailer to send email from script/console where it raised the error of wrong number of arguments…

Zeeshan