Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action Mailer NameError: Undefined local variable or method `“smtp'

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!

like image 248
Daniel Bogart Avatar asked Dec 02 '22 19:12

Daniel Bogart


1 Answers

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"]
}
like image 50
Dylan Markow Avatar answered Dec 05 '22 07:12

Dylan Markow