ruby on rails - How to send the list of receivers of a actionmailer method to a different email? -
following actionmailer method sending bulk emails receivers.
def mail_to @default_email = "user@gmail.com" @receivers #contains array of receivers mail(bcc: @receiver, to: @default_mail) if @receiver.present? end this working fine. wanted send @default_email list of receivers in @receivers variable in form of text or list. there way can achieve within same method without having create actionmailer method purpose ?
you can pass @receivers variable in template , added condition @default_email can see @receiver variable. eg
template
<% if user.email == "user@gmail.com" %> <% @receivers.each |r| %> <%= r.email %> <%end%> <% end %>
Comments
Post a Comment