4
votes

I'm attempting to set up Action Mailer to send reset password emails for Devise in my development environment. I'm receiving the following error when starting my local server: undefined local variable or method `“smtp', referring to the "address: “smtp.gmail.com”" line in my code. Here is the Action Mailer code I have added in 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 the environment variables set up in a .env file in the root directory. Thanks!

1

1 Answers

17
votes

It's because you're using smart quotes, “ ” instead of " ", probably from copy/pasting. Replace these with standard quotes:

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"]
}