mmailer 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +13 -9
- data/lib/mmailer/commands.rb +10 -0
- data/lib/mmailer/providers.rb +4 -2
- data/lib/mmailer/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -56,8 +56,6 @@ To restart from the 56th element in your queue (more on this later).
|
|
56
56
|
|
57
57
|
$ mmailer start 56
|
58
58
|
|
59
|
-
The results of above commands are displayed in the server terminal.
|
60
|
-
|
61
59
|
### Bundler
|
62
60
|
|
63
61
|
Although this gem performs as a standalone program, nothing prevents you from adding the following in a project's Gemfile:
|
@@ -104,10 +102,10 @@ end
|
|
104
102
|
|
105
103
|
* `from`: The from address that will be used in your emails.
|
106
104
|
* `subject`: The subject of your email.
|
107
|
-
* `provider`: The name of your provider. These are preset. For the moment,
|
105
|
+
* `provider`: The name of your provider. These are preset. For the moment, one of `:gmail`, `:zoho` or `:mandrill`. Please add more providers via pull requests or by sending me mail.
|
108
106
|
* `time_interval`: The number of seconds we want to wait between emails. We use this value as a ceiling when randomizing.
|
109
107
|
* `mail_interval`: After how many emails we wait before continuing.
|
110
|
-
* `sleep_time`: How long we wait when we reach the mail interval.
|
108
|
+
* `sleep_time`: How long we wait when we reach the mail interval/threshold.
|
111
109
|
* `collection`: An array of objects that respond to an `email` message. In the above example, the objects also respond to a `name` message. This will prove handy in templates. Instead of directly providing the array, it is recommended to specify a lambda that returns said array. You will then be able to make expensive calls to your database, bringing as many objects as memory permits, without impacting the server startup time.
|
112
110
|
* `template`: The path (relative to the current directory) and filename to the ERB templates for your mail, without suffix. For example, "newsletter". This means your template files are actually "newsletter.txt.erb" and "newsletter.html.erb" in the current directory.
|
113
111
|
|
@@ -127,7 +125,7 @@ Yours.
|
|
127
125
|
And the equivalent html template.
|
128
126
|
|
129
127
|
```ruby
|
130
|
-
<p>Dear <em><%= user.name %></em
|
128
|
+
<p>Dear <em><%= user.name %></em></p>
|
131
129
|
<p>This is my newsletter.</p>
|
132
130
|
<p>Yours.</p>
|
133
131
|
```
|
@@ -170,7 +168,7 @@ Mmailer.configure do |config|
|
|
170
168
|
config.provider = :gmail
|
171
169
|
config.subject = "My newsletter"
|
172
170
|
config.template = "newsletter"
|
173
|
-
config.collection = lambda { User.all.entries}
|
171
|
+
config.collection = lambda { User.all.entries }
|
174
172
|
config.time_interval = 6
|
175
173
|
config.from = 'John Doe <john@example.com>'
|
176
174
|
end
|
@@ -222,6 +220,10 @@ The server exposes an object representing the state of your queue (started/stopp
|
|
222
220
|
|
223
221
|
We use MicroMachine, a minimal finite state machine, to help with the state transitioning.
|
224
222
|
|
223
|
+
### Mail
|
224
|
+
|
225
|
+
We leverage the ubiquitous Mail gem to do the actual sending of email.
|
226
|
+
|
225
227
|
### CLI
|
226
228
|
|
227
229
|
We used Thor to provide a command line interface.
|
@@ -232,17 +234,19 @@ This program will be best served with some sort of GUI. A web-based interface (u
|
|
232
234
|
|
233
235
|
## Status
|
234
236
|
|
235
|
-
This
|
237
|
+
This is an initial release. Currently, no checks or sanitation is done when parsing the configuration. Mmailer will just blow up when an error is encountered. At this early stage, the project targets power users and contributors. Others may want to wait for a later release that will hopefully sport a web interface with better usability.
|
236
238
|
|
237
|
-
##
|
239
|
+
## Roadmap
|
238
240
|
|
239
241
|
* [] Web interface
|
240
242
|
* [X] Command-line interface
|
241
243
|
* [] Documentation
|
244
|
+
* [] Test suite
|
245
|
+
* [] Generic template engine (Tilt, https://github.com/rtomayko/tilt)
|
242
246
|
|
243
247
|
## Spam
|
244
248
|
|
245
|
-
Mmailer is a mail sending tool. Don't use it for spamming purposes. Spam is evil.
|
249
|
+
Mmailer is a bulk mail sending tool. Don't use it for spamming purposes. Spam is evil.
|
246
250
|
|
247
251
|
## Contributing
|
248
252
|
|
data/lib/mmailer/commands.rb
CHANGED
@@ -7,25 +7,35 @@ class MyCLI < Thor
|
|
7
7
|
end
|
8
8
|
|
9
9
|
desc "start FROM", "Start an email run from FROM (default is 0, start of the collection)."
|
10
|
+
|
10
11
|
def start(from=0)
|
11
12
|
client(:start, from.to_i)
|
12
13
|
end
|
13
14
|
|
14
15
|
desc "pause", "Pause an email run."
|
16
|
+
|
15
17
|
def pause
|
16
18
|
client(:pause)
|
17
19
|
end
|
18
20
|
|
19
21
|
desc "resume", "Resume an email run."
|
22
|
+
|
20
23
|
def resume
|
21
24
|
client(:resume)
|
22
25
|
end
|
23
26
|
|
24
27
|
desc "stop", "Stop an email run and exit server."
|
28
|
+
|
25
29
|
def stop
|
26
30
|
client(:stop)
|
27
31
|
end
|
28
32
|
|
33
|
+
desc "version", "Show mmailer version"
|
34
|
+
|
35
|
+
def version
|
36
|
+
require 'mmailer'
|
37
|
+
puts Mmailer::VERSION
|
38
|
+
end
|
29
39
|
|
30
40
|
private
|
31
41
|
|
data/lib/mmailer/providers.rb
CHANGED
@@ -29,11 +29,13 @@ module Mmailer
|
|
29
29
|
|
30
30
|
@zoho = Proc.new do
|
31
31
|
delivery_method :smtp, {
|
32
|
-
:port =>
|
32
|
+
:port => 465,
|
33
33
|
:address => "smtp.zoho.com",
|
34
34
|
:user_name => ENV['ZOHO_USERNAME'],
|
35
35
|
:password => ENV['ZOHO_PASSWORD'],
|
36
|
-
:authentication => :
|
36
|
+
:authentication => :login,
|
37
|
+
:ssl => true,
|
38
|
+
:tls => true,
|
37
39
|
:enable_starttls_auto => true
|
38
40
|
}
|
39
41
|
end
|
data/lib/mmailer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|