README.rdoc in sendgrid-rails-1.0.0 vs README.rdoc in sendgrid-rails-1.1.0
- old
+ new
@@ -5,19 +5,18 @@
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)
-== Examples
+== Rails 3 configuration
-=== Rails 3 configuration
-
In your Gemfile:
- gem 'sendgrid-rails', '>=1.0.0', :git => 'git://github.com/PavelTyk/sendgrid-rails.git'
+ gem 'sendgrid-rails', '>=1.0.0'
In your config/environment.rb:
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
@@ -26,19 +25,21 @@
:authentication => :plain,
:user_name => 'login@example.com',
:password => 'your password'
}
-==== Adding multiple recipients:
+== Usage examples
+=== Adding multiple recipients:
+
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 :body => 'Hello.'
+ mail
end
end
=== Adding substitution vars
@@ -46,16 +47,31 @@
class Mailer < ActionMailer::Base
default :from => 'no-reply@example.com',
:subject => 'An email sent via SendGrid with substitutions'
- def mail_with_substitutions
- emails = %w(email1@email.com email2@email.com)
- names = %w(User1 User2)
+ def email_with_substitutions
+ add_recipients %w(email1@email.com email2@email.com)
+ substitute '-user_name-', %w(User1 User2)
- add_recipients emails
- substitute '-user_name-', names
+ mail :body => "Hello, -user_name-!"
+ end
+ end
- mail :body => "Hello, -user_name-."
+== Apps (formerly called Filters)
+
+Apps can be applied to any of your email messages and can be configured through SendGrid gem.
+
+=== Open Tracking
+
+Add an invisible image at the end of the email to track e-mail opens. If the email recipient has images enabled on the email client, a request to server for the invisible image is executed and an open is logged.
+
+ class Mailer < ActionMailer::Base
+ default :from => 'no-reply@example.com',
+ :subject => 'An email sent via SendGrid'
+
+ def email_with_open_tracking_enabled
+ open_tracking true
+ mail :to => 'email@email.com'
end
end