SendGrid ActionMailer在开发模式下工作

时间:2014-06-13 02:29:37

标签: ruby-on-rails heroku sendmail actionmailer sendgrid

我想在我的应用程序中集成SendGrid并测试本地的工作方式,所以我的代码会在新用户注册时发送电子邮件。我让我的控制器调用Notifier.welcome_email(user).deliver

当我拖尾日志时,我看到的唯一相关内容是:

渲染通知器/ welcome_email.html.erb(1.3ms)

但是没有发送电子邮件。在我的环境/ development.rb

config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
:address        => 'smtp.sendgrid.net',
:port           => '587',
:authentication => :plain,
:user_name      => '<user-name-is-here-actually.',
:password       => '<and-the-password>',
:domain         => 'domain.com',
:enable_starttls_auto => true
}

我仍然没有看到任何事情发生。任何人都可以帮助我在本地工作吗?

1 个答案:

答案 0 :(得分:1)

解决方案只是确保在Notifier方法上调用'deliver'。