Commit 833c3aafa9a19bf3bdfecfad97e6bb4a883fe56f
1 parent
24539bcc
Exists in
master
and in
1 other branch
Adding sendgrid support to pairwise
Showing
4 changed files
with
11 additions
and
11 deletions
Show diff stats
app/models/cron_mailer.rb
| 1 | +unless Rails.env == "development" | ||
| 2 | + include SendGrid | ||
| 3 | +end | ||
| 1 | class CronMailer < ActionMailer::Base | 4 | class CronMailer < ActionMailer::Base |
| 2 | 5 | ||
| 3 | def info_message(recipients, subject, message, sent_at= Time.now) | 6 | def info_message(recipients, subject, message, sent_at= Time.now) |
| @@ -8,8 +11,4 @@ class CronMailer < ActionMailer::Base | @@ -8,8 +11,4 @@ class CronMailer < ActionMailer::Base | ||
| 8 | @body[:message] = message | 11 | @body[:message] = message |
| 9 | @body[:host] = "www.allourideas.org" | 12 | @body[:host] = "www.allourideas.org" |
| 10 | end | 13 | end |
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | end | 14 | end |
config/environment.rb
config/initializers/mail.rb
| @@ -3,14 +3,13 @@ | @@ -3,14 +3,13 @@ | ||
| 3 | 3 | ||
| 4 | # heroku config:add GMAIL_EMAIL=dcroak@example.com GMAIL_PASSWORD=password | 4 | # heroku config:add GMAIL_EMAIL=dcroak@example.com GMAIL_PASSWORD=password |
| 5 | 5 | ||
| 6 | -require 'smtp-tls' | ||
| 7 | - | ||
| 8 | ActionMailer::Base.smtp_settings = { | 6 | ActionMailer::Base.smtp_settings = { |
| 9 | - :address => "smtp.gmail.com", | ||
| 10 | - :port => "587", | 7 | + :address => "smtp.sendgrid.net", |
| 8 | + :port => "25", | ||
| 11 | :authentication => :plain, | 9 | :authentication => :plain, |
| 12 | - :user_name => ENV['GMAIL_EMAIL'], | ||
| 13 | - :password => ENV['GMAIL_PASSWORD'] | 10 | + :domain => "allourideas.org", |
| 11 | + :user_name => ENV['SENDGRID_USERNAME'], | ||
| 12 | + :password => ENV['SENDGRID_PASSWORD'] | ||
| 14 | } | 13 | } |
| 15 | 14 | ||
| 16 | DO_NOT_REPLY = "donotreply@example.com" | 15 | DO_NOT_REPLY = "donotreply@example.com" |
lib/tasks/test_api.rake
| @@ -375,7 +375,7 @@ namespace :test_api do | @@ -375,7 +375,7 @@ namespace :test_api do | ||
| 375 | delta = 0.001 | 375 | delta = 0.001 |
| 376 | 376 | ||
| 377 | if (cached_score - generated_score).abs >= delta | 377 | if (cached_score - generated_score).abs >= delta |
| 378 | - error_message += "Error! The cached_score is not equal to the calculated score for choice #{choice.id}" | 378 | + error_message += "Error! The cached_score is not equal to the calculated score for choice #{choice.id}\n" |
| 379 | 379 | ||
| 380 | print "This score is wrong! #{choice.id} , Question ID: #{question.id}, #{cached_score}, #{generated_score}, updated: #{choice.updated_at}\n" | 380 | print "This score is wrong! #{choice.id} , Question ID: #{question.id}, #{cached_score}, #{generated_score}, updated: #{choice.updated_at}\n" |
| 381 | 381 |