I'm trying to send mails with the name of the user in the from address. Something like "John Doe <john@doe.com>"
. I went through a lot of SO solutions, but still couldn't get this to work.
Here's the mailer:
def trigger_email(send_mail, contact, user)
@mailer = send_mail
@email = contact.email
@user = User.find(user)
mail(to: @email, subject: @mailer.subject, from: "\"#{@user.name}\" <@user.email>")
end
I have tried quite a few variants of the above but nothing works. Would appreciate a solution to this issue.