I am trying to configure Action Mailer to send reset emails with a password for Devise in my development environment. When starting a local server, I get the following error: undefined local variable or the `` smtp '' method, referring to the line "address:" smtp.gmail.com "" in my code. Here is the Mailer action code I added to my development.rb file:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["GMAIL_DOMAIN"],
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
I have environment variables set in the .env file in the root directory. Thank!
source
share