0

In development.rb I have these ActionMailer settings:

config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "gmail.com",
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: "username@gmail.com",
  password: "password"
}

In notifier.rb (my mailer) I have these definitions:

def user_email(user)
  @user = User.find(user)
  mail(:to => user.email, :subject => "Welcome to me.")
end

def test_email
  mail(:to => "here@there.com", :subject => "Test mail", :body => "Ain't I shapely?")
end

And running Notifier.test_email.deliver in the console gives me this: wrong number of arguments (0 for 1).

And running Notifier.user_email(2).deliver in the console gives me this: undefined method 'user_email' for Notifier:Class.

Am I missing something totally obvious here? The Gmail settings are all correct, but obviously the issue is before that.

4

1 回答 1

0

重新启动服务器修复它。废话。

于 2013-02-18T02:21:35.780 回答