README.md in mailkick-0.2.1 vs README.md in mailkick-0.3.0

- old
+ new

@@ -1,16 +1,17 @@ # Mailkick -:bullettrain_side: Email subscriptions made easy +Email subscriptions made easy - Add one-click unsubscribe links to your emails - Fetch bounces and spam reports from your email service +- Gracefully handles email address changes -Gracefully handles email address changes - :postbox: Check out [Ahoy Email](https://github.com/ankane/ahoy_email) for analytics +[![Build Status](https://travis-ci.org/ankane/mailkick.svg?branch=master)](https://travis-ci.org/ankane/mailkick) + ## Installation Add this line to your application’s Gemfile: ```ruby @@ -19,11 +20,11 @@ And run the generator. This creates a model to store opt-outs. ```sh rails generate mailkick:install -rake db:migrate +rails db:migrate ``` ## How It Works Add an unsubscribe link to your emails. @@ -55,11 +56,11 @@ Before sending marketing emails, make sure the user has not opted out. Add the following method to models with email addresses. ```ruby -class User < ActiveRecord::Base +class User < ApplicationRecord mailkick_user end ``` Get all users who have opted out @@ -135,25 +136,16 @@ Mailkick::Service::Sendgrid.new(api_key: "API_KEY"), Mailkick::Service::Mandrill.new(api_key: "API_KEY") ] ``` -## Multiple Lists [beta] +## Multiple Lists -You may want to split your emails into multiple categories, like sale emails and order reminders. +You may want to split your emails into multiple categories, like sale emails and order reminders. Set the list in the url: -Set the list in the mailer. - ```ruby -class UserMailer < ActionMailer::Base - - def order_reminder(user) - headers[:mailkick_list] = "order_reminders" - # ... - end - -end +mailkick_unsubscribe_url(list: "order_reminders") ``` Pass the `list` option to methods. ```ruby @@ -183,20 +175,15 @@ More great gems for email - [Roadie](https://github.com/Mange/roadie) - inline CSS - [Letter Opener](https://github.com/ryanb/letter_opener) - preview email in development -## TODO - -- Make it easy to customize controller -- Subscribe to events - ## Reference Change how the user is determined ```ruby -Mailkick.user_method = -> (email) { User.find_by(email: email) } +Mailkick.user_method = ->(email) { User.find_by(email: email) } ``` Use a different email field ```ruby