README.rdoc in sendgrid-rails-1.1.1 vs README.rdoc in sendgrid-rails-2.0

- old
+ new

@@ -1,25 +1,26 @@ = SendGrid gem for Rails -SendGrid gem provides ActionMailer extensions to use SendGrid API features in you emails. +SendGrid gem provides ActionMailer::Base extensions to use SendGrid API features in you emails. It extends ActionMailer with next methods: - add_recipients(array_of_emails) substitute(patters_string, array_of_substitunion_strings) uniq_args(hash_of_unique_args) category(category_string) open_tracking(enabled = true) add_filter_setting(filter_name, setting_name, value) == Rails 3 configuration In your Gemfile: - gem 'sendgrid-rails', '>=1.0.0' + gem 'sendgrid-rails', '~> 2.0' In your config/environment.rb: + ActionMailer::Base.register_interceptor(SendGrid::MailInterceptor) + ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '25', :domain => 'example.com', :authentication => :plain, @@ -34,12 +35,11 @@ class Mailer < ActionMailer::Base default :from => 'no-reply@example.com', :subject => 'An email sent via SendGrid' def email_with_multiple_recipients - add_recipients %w(email1@email.com email2@email.com) - mail + mail :to => %w(email1@email.com email2@email.com) end end === Adding substitution vars @@ -48,17 +48,30 @@ class Mailer < ActionMailer::Base default :from => 'no-reply@example.com', :subject => 'An email sent via SendGrid with substitutions' def email_with_substitutions - add_recipients %w(email1@email.com email2@email.com) substitute '-user_name-', %w(User1 User2) - mail :body => "Hello, -user_name-!" + mail :to => %w(email1@email.com email2@email.com), :body => "Hello, -user_name-!" end end +=== Adding category + + Mailer class definition: + + class Mailer < ActionMailer::Base + default :from => 'no-reply@example.com', + :subject => 'An email sent via SendGrid with substitutions' + + def email_with_category + category 'SendGridRocks' + mail :to => 'email1@email.com' + end + end + == Apps (formerly called Filters) Apps can be applied to any of your email messages and can be configured through SendGrid gem. === Open Tracking @@ -73,5 +86,12 @@ open_tracking true mail :to => 'email@email.com' end end +== Change log + +*v2.0* + +* Using mail interceptor +* ActionMailer::Base#add_recipients - removed +* Standard SMTP To attribute get nullified after recipients added to X-SMTPAPI header