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!
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"]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With