Get Email from DataBase for creating newsletter
I am trying to create a newsletter, Ive followed this instructional video on how to save the information but I am confused on what to do from the end of the video,
https://www.youtube.com/watch?v=mavV5LH-Z40&feature=emb_title
After checking my console it seems that everything is being saved correctly im just wondering how to now get that information to the action mailer gem
Check out the Actionmailer guides: https://guides.rubyonrails.org/action_mailer_basics.html
If you had a LeadMailer
that sent a new_lead
email, it would be:
LeadMailer.with(lead: @lead).new_lead.deliver_later
So would it look something like this? I'm confused as to where the program takes the email from the database as there isn't a user defined.
class LeadMailer.with(lead: @lead).new_lead.deliver_later < ApplicationMailer
def welcome_email
mail(to: params[:user].email) do |format|
format.html { render layout: 'my_layout' }
format.text
end
end
end