[Radiant] Mailer behavior...anybody have any more tips to get it working?

Bodhi bodhi at theplant.jp
Tue Oct 17 00:30:25 CDT 2006


On 17/10/2006, at 2:18 PM, jsmorris wrote:

> Still working on trying to get the mailer behavior to work.  I tried
> to configure the ActionMailer in both files, but no success.  I do,
> however, now get an error message on my page after I try to send the
> mail.  The error is
>
> "Error encounter while trying to send email. undefined method
> `deliver_generic_mailer' for ActionMailer::Base:Class"
>
> So, I got my hands dirty and tried to debug the code provided in the
> behavior.  It looks like in the send_mail() method, the author is
> trying to dynamically add a method to the ActionMailer::Base class,
> but I am still too new to ruby to understand this completely.
>
> My confusion is why the error message is saying that the calling
> method is deliver_generic_mailer, but the method that the author is
> adding to the ActionMailer::Base is called generic_mailer.  I tried to
> just call this method, but that didn't work.

When you want to deliver email with ActionMailer, you have to prefix  
your method with "deliver_", e.g. ActionMailer#generic_mailer  
(instance method) needs to be called with  
ActionMailer::deliver_generic_mailer (class method)

the << CODE <snip> CODE stuff is a heredoc [1] used to define the  
mailer method to use UNLESS it is already defined. Then the second  
half of the method calls ActionMailer to deliver the email. I had it  
working a few months ago, I'll try to dig up the code and put the  
setup on the wiki (if i can find some spare some time for radiant :(   )

Bodhi

[1] http://en.wikipedia.org/wiki/Heredoc



More information about the Radiant mailing list