I''m trying to call multiple email addresses from database. But dont
know how to get the logic into the recipients field.
#subscriptions_controller
def deliver
@subscription = Subscription.find(params[:id])
@users = @subscription.users
@subscription_recipients = @users.find(:all).collect { |user|
user.email }
@subscription.deliver
flash[:notice] = "Delivered Subscription"
redirect_to subscriptions_url
end
#subscription.rb
def deliver
UserMailer.deliver_lotto_saturday_subscription(@user, @subscription)
update_attribute(:schedule_delivery, Time.now)
end
#user_mailer.rb
class UserMailer < ActionMailer ::Base
def lotto_saturday_subscription(user, subscription)
@recipients = ????????
from "lottomail.net"
subject "Your Lotto Saturday Reminder"
body :user => user
end
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
depassion wrote:> I''m trying to call multiple email addresses from database. But dont > know how to get the logic into the recipients field. >> > def lotto_saturday_subscription(user, subscription) > @recipients = ???????? > from "lottomail.net" > subject "Your Lotto Saturday Reminder" > body :user => user > end >This is kind of a shot in the dark, but .. When I have to hold several items, I make a list, also called an array, of elements. Have you tried that? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
depassion wrote:> #user_mailer.rb > class UserMailer < ActionMailer ::Base > > def lotto_saturday_subscription(user, subscription) > @recipients = ???????? > from "lottomail.net" > subject "Your Lotto Saturday Reminder" > body :user => user > endSomething along the lines of: user.all.collect{|user| user.email} -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe Matching Threads
- Multiple recipients of list (SAMBA digest 2060)
- Bug#439207: postgrey: multiple recipients generates slightly different whitelisted message
- accessing bcc recipients in ActionMailer view
- VM notification to multiple email recipients
- lmtp sometimes fails to deliver a message to all recipients