Thursday, September 9, 2010

[Rails] Re: dynamically changing ActionMailer::Base.delivery_method

On Sep 9, 6:47 am, Ram <yourstruly.vi...@gmail.com> wrote:
> Hi all,
>
> I need some of my emails to go out using "smtp" and some others using
> "sendmail" . Is there a clean way to switch between these two deliver
> methods depending upon the mailer method?
>

I think (but do test this!) that you could do something like

class SmtpMailer < AM::Base
self.delivery_method = :smtp
end

class SendmailMailer < AM::Base
self.delivery_method = :sendmail
end

and then derive mailers from those two classes as appropriate. If you
have identical mail that needs to be delivered via either of those two
mechanisms then it might be a bit more complicated.

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate