From 833c3aafa9a19bf3bdfecfad97e6bb4a883fe56f Mon Sep 17 00:00:00 2001 From: Dhruv Kapadia Date: Wed, 11 Aug 2010 20:48:45 -0400 Subject: [PATCH] Adding sendgrid support to pairwise --- app/models/cron_mailer.rb | 7 +++---- config/environment.rb | 2 ++ config/initializers/mail.rb | 11 +++++------ lib/tasks/test_api.rake | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/cron_mailer.rb b/app/models/cron_mailer.rb index 3f71b02..5c854d4 100644 --- a/app/models/cron_mailer.rb +++ b/app/models/cron_mailer.rb @@ -1,3 +1,6 @@ +unless Rails.env == "development" + include SendGrid +end class CronMailer < ActionMailer::Base def info_message(recipients, subject, message, sent_at= Time.now) @@ -8,8 +11,4 @@ class CronMailer < ActionMailer::Base @body[:message] = message @body[:host] = "www.allourideas.org" end - - - - end diff --git a/config/environment.rb b/config/environment.rb index 77b711e..d489ebb 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -53,5 +53,7 @@ Rails::Initializer.run do |config| :version => '2.0.3' config.gem 'redis', :version => '1.0.7' + + config.gem 'sendgrid' end diff --git a/config/initializers/mail.rb b/config/initializers/mail.rb index 7ad61d3..d68fdb6 100644 --- a/config/initializers/mail.rb +++ b/config/initializers/mail.rb @@ -3,14 +3,13 @@ # heroku config:add GMAIL_EMAIL=dcroak@example.com GMAIL_PASSWORD=password -require 'smtp-tls' - ActionMailer::Base.smtp_settings = { - :address => "smtp.gmail.com", - :port => "587", + :address => "smtp.sendgrid.net", + :port => "25", :authentication => :plain, - :user_name => ENV['GMAIL_EMAIL'], - :password => ENV['GMAIL_PASSWORD'] + :domain => "allourideas.org", + :user_name => ENV['SENDGRID_USERNAME'], + :password => ENV['SENDGRID_PASSWORD'] } DO_NOT_REPLY = "donotreply@example.com" diff --git a/lib/tasks/test_api.rake b/lib/tasks/test_api.rake index 2189218..64edf9f 100644 --- a/lib/tasks/test_api.rake +++ b/lib/tasks/test_api.rake @@ -375,7 +375,7 @@ namespace :test_api do delta = 0.001 if (cached_score - generated_score).abs >= delta - error_message += "Error! The cached_score is not equal to the calculated score for choice #{choice.id}" + error_message += "Error! The cached_score is not equal to the calculated score for choice #{choice.id}\n" print "This score is wrong! #{choice.id} , Question ID: #{question.id}, #{cached_score}, #{generated_score}, updated: #{choice.updated_at}\n" -- libgit2 0.21.2