email_campaign 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  =email_campaign
2
2
 
3
- For mailings related to Rails apps, email_campaign is designed to be a more flexible, more integrated (yet well-abstracted) alternative to email campaign services like Campaign Monitor and MailChimp. Designed to use SendGrid for delivery, but this is easy changed.
3
+ For mailings related to Rails apps, email_campaign is designed to be a more flexible, more integrated (yet well-abstracted) alternative to email campaign services like Campaign Monitor and MailChimp. Developed using {SendGrid}[http://sendgrid.com/] for delivery (via the ActionMailer::Base.smtp_settings), but feel free to use whatever you want.
4
4
 
5
5
  =Roadmap
6
6
 
@@ -108,6 +108,40 @@ Finally, create an initializer that sets base_url (since urls in emails need to
108
108
  # EmailCampaign::Handler as it would appear in url_for(:controller => '...')
109
109
  EmailCampaign::Config.controller_name = 'email'
110
110
 
111
+ Okay, now how do we actually send this thing? You'll want to make a controller for this eventually, but for now let's use the console:
112
+
113
+ # create a campaign, making sure to specify the mailer class and method we created earlier
114
+ c = EmailCampaign::Campaign.find_or_create_by_name(:name => 'Campaign 2013a')
115
+ c.mailer = 'Campaign'
116
+ c.method = 'campaign2013a'
117
+ c.save
118
+
119
+ # recipients can be any object that responds to #name, #email_address and #id (or optionally, #subscriber_id)
120
+ class TestRecipient
121
+ attr_accessor :name, :email_address, :subscriber_id
122
+ def initialize(name, email_address, subscriber_id)
123
+ @name = name ; @email_address = email_address ; @subscriber_id = subscriber_id
124
+ end
125
+ end
126
+
127
+ rcpts = [ TestRecipient.new('Aaron Namba', 'aaron@mysite.com', 1) ]
128
+
129
+ # this will create EmailCampaign::Recipient objects (c.recipients), which contain delivery status
130
+ # information (e.g. #delivered, #failed, #failure_reason, #opened, #clicked)
131
+ counts = c.add_recipients(rcpts, :force => true)
132
+
133
+ if c.queue
134
+ # use dj to send in 5 minutes; deliver! also uses dj to queue up individual emails
135
+ c.delay(:run_at => 5.minutes.from_now).deliver!
136
+ puts "Emails queued for immediate delivery. #{counts[:processed]} processed, #{counts[:skipped]} skipped, #{counts[:valid]} valid, #{counts[:invalid]} invalid, #{counts[:duplicate]} duplicate, #{counts[:unsubscribed]} unsubscribed, #{counts[:total]} total in queue."
137
+ end
138
+
139
+ Start dj if you haven't already:
140
+
141
+ script/delayed_job start
142
+
143
+
144
+
111
145
  =Getting Help
112
146
 
113
147
  Get paid support for EmailCampaign straight from the people who made it: {Bigger Bird Creative, Inc.}[https://www.biggerbird.com] Not required, of course. :-) Free support is up top (Issues).
@@ -10,6 +10,9 @@ module EmailCampaign
10
10
  Rails.application.config.assets.precompile += %w( email_campaign/open-tracker.gif )
11
11
  end
12
12
 
13
+ require 'email_campaign/config'
14
+ require 'email_campaign/handler'
15
+
13
16
  #
14
17
  # activate gems as needed
15
18
  #
@@ -1,3 +1,3 @@
1
1
  module EmailCampaign
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_campaign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: