Question: How do I set up my mailer/devise to allow the "from" to be from the current_user.email versus just one email?
Explanation: I have connected my rails mailer to use Microsoft exchange. Everything is working fine, but the issue I am running into is who the "from" in the emails (development.rb, mailer, and devise.rb) has to be the same in order for the emails to go out. Our application has different admin users, and we would like the outgoing emails to come from their email versus just one.
this is the link I followed for setting up microsoft exchage. "https://www.brownwebdesign.com/blog/connecting-rails-to-microsoft-exchange-smtp-email-server"
I have tried using Devise Doc to set-up a mailer to specify my FROM, but still doesn't work.. "https://github.com/plataformatec/devise/wiki/How-To:-Use-custom-mailer"
def confirmation_instructions(record, token, opts={})
headers["Custom-header"] = "Bar"
opts[:from] = '[email protected]'
opts[:reply_to] = '[email protected]'
super
end
I am jr developer and haven't worked much with changing mailer settings. This is my mailer. My controller is bringing the current_user over, and is logging correctly.
class FeedbackMailer < ActionMailer::Base
default to: "[email protected]"
def question_email(email, type, notes, current_user)
@user_email = current_user.email
logger.debug("Are you getting the email or what? # .
{@user_email.inspect}")
logger.debug("LOOKING FOR THE EMAIL #{email}")
@email = email
@type = type
@notes = notes
mail( from: "[email protected]", subject:
"You have Feedback")
end
end