I''m trying to perform a search a a list of people and then create an
email based on the emails found in the result set. Any idea how to do
this? I figure this is a model topic as I need the figure out the
logic to generate an array of the emails in the results set. I''m using
the acts_as_ferret plugin and the instance variable is @volunteers
which means that the emails I need are in the instance variable
@volunteers but I don''t know how to get them out of it and into the
mail_to link below - hopefully in the form of a nice method like
"volunter_emails_from_search" below.
The code to generate the email looks like the following:
[code: ruby]
<%= mail_to "#{volunter_emails_from_search}", "Email",
:subject =>
"This is an example email" %>
[/code]
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Is @volunteers an array of Volunteer models, perhaps where each has an :email attribute? Assuming that, it''s just a matter of iterating... <% @volunteers.each do |volunteer| %> <%= mail_to volunteer.email, volunteer.email, :subject => "the example subject" %> <% end %> The "volunteer.email" is listed twice because it''s the link and it''s the display for the link. Does that help? Or were you needing something else? -Danimal On Apr 10, 1:24 pm, Etandrib <nateb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to perform a search a a list of people and then create an > email based on the emails found in the result set. Any idea how to do > this? I figure this is a model topic as I need the figure out the > logic to generate an array of the emails in the results set. I''m using > the acts_as_ferret plugin and the instance variable is @volunteers > which means that the emails I need are in the instance variable > @volunteers but I don''t know how to get them out of it and into the > mail_to link below - hopefully in the form of a nice method like > "volunter_emails_from_search" below. > > The code to generate the email looks like the following: > [code: ruby] > <%= mail_to "#{volunter_emails_from_search}", "Email", :subject => > "This is an example email" %> > [/code]--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m actually looking to have one mail link that will mail to all the recipients below. So if I have 5 volunteers in the search results I can email them with a single click. Iterating just gives me multiple email links which I can easily do with the results. This should be a really easy thing to do I just can''t figure out how to pass an array of email address to the mail_to parameters so I have a single link with an array of addresses. On Apr 11, 10:50 am, Danimal <fightonfightw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is @volunteers an array of Volunteer models, perhaps where each has > an :email attribute? > > Assuming that, it''s just a matter of iterating... > > <% @volunteers.each do |volunteer| %> > <%=mail_tovolunteer.email, volunteer.email, :subject => "the > example subject" %> > <% end %> > > The "volunteer.email" is listed twice because it''s the link and it''s > the display for the link. > > Does that help? Or were you needing something else? > > -Danimal > > On Apr 10, 1:24 pm, Etandrib <nateb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m trying to perform a search a a list of people and then create an > > email based on the emails found in the result set. Any idea how to do > > this? I figure this is a model topic as I need the figure out the > > logic to generate an array of the emails in the results set. I''m using > > the acts_as_ferret plugin and the instance variable is @volunteers > > which means that the emails I need are in the instance variable > > @volunteers but I don''t know how to get them out of it and into the > >mail_tolink below - hopefully in the form of a nice method like > > "volunter_emails_from_search" below. > > > The code to generate the email looks like the following: > > [code: ruby] > > <%=mail_to"#{volunter_emails_from_search}", "Email", :subject => > > "This is an example email" %> > > [/code]--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
Etandrib wrote:> I''m actually looking to have one mail link that will mail to all the > recipients below. So if I have 5 volunteers in the search results I > can email them with a single click. Iterating just gives me multiple > email links which I can easily do with the results. This should be a > really easy thing to do I just can''t figure out how to pass an array > of email address to the mail_to parameters so I have a single link > with an array of addresses.Create a button in the view that will post back with the list of addressees, and have the controller call a model method to do the emails... somebody somewhere will have to do the iteration, and I''d guess it should be the controller, unless you have a volunteer_list model that understands multiple volunteers. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
http://www.sightspecific.com/~mosh/WWW_FAQ/multrec.html
The problem is that there is no ideal way to include multiple
addresses in the mail_to link.
So, I see two options:
1) just use one of the "nonstandard" ways, like having a list of email
addresses separated by commas, or
2) instead of using a mail_to link, have it call an action and have
that action use ActionMailer. Then, you can specify all the addresses
you need.
If you go with option 1, just use: join(",") on the email addresses
array.
If you go with option 2, which is much better but more work, you can
pass the array in as the recipients list.
HTH!
-Danimal
On Apr 14, 8:26 am, Etandrib
<nateb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m actually looking to have one mail link that will mail to all
the
> recipients below. So if I have 5 volunteers in the search results I
> can email them with a single click. Iterating just gives me multiple
> email links which I can easily do with the results. This should be a
> really easy thing to do I just can''t figure out how to pass an
array
> of email address to the mail_to parameters so I have a single link
> with an array of addresses.
>
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---