tuktuk 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +57 -3
- data/bin/tuktuk +1 -1
- data/lib/tuktuk/tuktuk.rb +5 -3
- data/lib/tuktuk/version.rb +1 -1
- data/spec/deliver_spec.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7372b2bc0d09b1c9b88fe82f013528dc9997811e
|
4
|
+
data.tar.gz: 05db8f38889e63c22d6542bfcf04b966a71827ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312b8cc15164b282191c4e519973a0c93afff143644a9b23aa1815d9a6d80a625b11a57a53350fbf7f38d0e8dba7e24522431d56d4b536742b10ebaa9863ed05
|
7
|
+
data.tar.gz: 5dc1afa0829e7c96d344455f01def4d401de8d1e3ea00dd6171f149e335087d1ff435d987b17846ec93f7c6400851a217f2c6712ca10075dd8a8d8ca84b698c4
|
data/README.md
CHANGED
@@ -25,6 +25,21 @@ message = {
|
|
25
25
|
response, email = Tuktuk.deliver(message)
|
26
26
|
```
|
27
27
|
|
28
|
+
HTML (multipart) emails are supported, of course.
|
29
|
+
|
30
|
+
``` ruby
|
31
|
+
|
32
|
+
message = {
|
33
|
+
:from => 'you@username.com',
|
34
|
+
:to => 'user@yoursite.com',
|
35
|
+
:body => 'Hello there',
|
36
|
+
:html_body => '<h1 style="color: red">Hello there</h1>',
|
37
|
+
:subject => 'Hiya in colours'
|
38
|
+
}
|
39
|
+
|
40
|
+
response, email = Tuktuk.deliver(message)
|
41
|
+
```
|
42
|
+
|
28
43
|
The `response` is either a Net::SMTP::Response object, or a Bounce exception (HardBounce or SoftBounce, depending on the cause). `email` is a [mail](https://github.com/mikel/mail) object. So, to handle bounces you'd do:
|
29
44
|
|
30
45
|
``` ruby
|
@@ -39,7 +54,46 @@ else
|
|
39
54
|
end
|
40
55
|
```
|
41
56
|
|
42
|
-
You can also call `Tuktuk.deliver!` (with a trailing `!`), in which case it will automatically raise an exception if the response was either a HardBounce or SoftBounce
|
57
|
+
You can also call `Tuktuk.deliver!` (with a trailing `!`), in which case it will automatically raise an exception if the response was either a `HardBounce` or a `SoftBounce`. This is useful when running in the background via Resque or Sidekiq, because it makes you aware of which emails are not getting through, and you can requeue those jobs to have them redelivered.
|
58
|
+
|
59
|
+
Email options
|
60
|
+
-------------
|
61
|
+
|
62
|
+
Attachments are supported, as you'd expect.
|
63
|
+
|
64
|
+
``` rb
|
65
|
+
message = {
|
66
|
+
:from => 'john@lennon.com',
|
67
|
+
:to => 'paul@maccartney.com',
|
68
|
+
:subject => 'Question for you',
|
69
|
+
:body => 'How do you sleep?',
|
70
|
+
:reply_to => '<haha@foobar.com>',
|
71
|
+
:return_path => 'bounces@server.com',
|
72
|
+
:attachments => [ '/home/john/walrus.png' ]
|
73
|
+
}
|
74
|
+
```
|
75
|
+
|
76
|
+
Attachments can be either a path to a file or a hash containing the file's name and content, like this:
|
77
|
+
|
78
|
+
``` rb
|
79
|
+
message = {
|
80
|
+
...
|
81
|
+
:attachments => [
|
82
|
+
{ :filename => 'walrus.png', :content => File.read('/home/john/walrus.png') }
|
83
|
+
]
|
84
|
+
}
|
85
|
+
```
|
86
|
+
|
87
|
+
These are the email headers Tuktuk is able to set for you. Just pass them as part of the hash and they'll be automatically set.
|
88
|
+
|
89
|
+
```
|
90
|
+
:return_path => '<return-path@host.com>', # will actually set three headers, Return-Path, Bounces-To and Errors-To
|
91
|
+
:reply_to => '<reply@to.com>',
|
92
|
+
:in_reply_to => '<inreply@to.com>',
|
93
|
+
:list_unsubscribe => '<http://server.com/path>, <mailto:somewhere@server.com>',
|
94
|
+
:list_archive => '<http://server.com/list/archive>',
|
95
|
+
:list_id => '<mail-list.foobar.com>'
|
96
|
+
```
|
43
97
|
|
44
98
|
Delivering multiple
|
45
99
|
-------------------
|
@@ -69,7 +123,7 @@ end
|
|
69
123
|
Options & DKIM
|
70
124
|
--------------
|
71
125
|
|
72
|
-
Now, if you want to enable DKIM (and you
|
126
|
+
Now, if you want to enable DKIM (and you _should_):
|
73
127
|
|
74
128
|
``` ruby
|
75
129
|
require 'tuktuk'
|
@@ -104,7 +158,7 @@ Tuktuk.options = {
|
|
104
158
|
}
|
105
159
|
```
|
106
160
|
|
107
|
-
You can set the `
|
161
|
+
You can set the `max_workers` option to `auto`, which will spawn the necessary threads to connect in paralell to all target MX servers when delivering multiple messages. When set to `0`, these batches will be delivered sequentially.
|
108
162
|
|
109
163
|
In other words, if you have three emails targeted to Gmail users and two for Hotmail users, using `auto` Tuktuk will spawn two threads and connect to both servers at once. Using `0` will have email deliveried to one host and then the other.
|
110
164
|
|
data/bin/tuktuk
CHANGED
data/lib/tuktuk/tuktuk.rb
CHANGED
@@ -5,8 +5,10 @@ require 'work_queue'
|
|
5
5
|
|
6
6
|
module Tuktuk; end
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
this_path = File.expand_path(File.dirname(__FILE__))
|
9
|
+
|
10
|
+
%w(package cache dns bounce).each { |lib| require this_path + "/#{lib}" }
|
11
|
+
require_relative this_path + '/version' unless defined?(Tuktuk::VERSION)
|
10
12
|
|
11
13
|
DEFAULTS = {
|
12
14
|
:helo_domain => nil,
|
@@ -116,7 +118,7 @@ module Tuktuk
|
|
116
118
|
mail.destinations.each do |to|
|
117
119
|
|
118
120
|
domain = get_domain(to)
|
119
|
-
raise "Empty domain: #{domain}" if domain.
|
121
|
+
raise "Empty domain: #{domain}" if domain.to_s.strip == ''
|
120
122
|
|
121
123
|
unless servers = smtp_servers_for_domain(domain)
|
122
124
|
return HardBounce.new("588 No MX records for domain #{domain}")
|
data/lib/tuktuk/version.rb
CHANGED
data/spec/deliver_spec.rb
CHANGED
@@ -169,7 +169,7 @@ describe 'deliver many' do
|
|
169
169
|
it 'does not try to send that same email to second server' do
|
170
170
|
Tuktuk.should_receive(:send_many_now).once.with('mx1.domain.com', @emails).and_return([@first])
|
171
171
|
last_two_emails = @emails.last(2)
|
172
|
-
last_two_emails.include?(@emails.first).should
|
172
|
+
last_two_emails.include?(@emails.first).should be false
|
173
173
|
Tuktuk.should_receive(:send_many_now).once.with('mx2.domain.com', last_two_emails).and_return(@last_two)
|
174
174
|
Tuktuk.should_not_receive(:send_many_now).with('mx3.domain.com')
|
175
175
|
Tuktuk.send(:lookup_and_deliver_by_domain, 'domain.com', @emails)
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuktuk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.0.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -42,42 +42,42 @@ dependencies:
|
|
42
42
|
name: mail
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: dkim
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.0.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.0.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: work_queue
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.5.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.5.0
|
83
83
|
description: Easy way of sending DKIM-signed emails from Ruby, no dependencies needed.
|
@@ -88,7 +88,7 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .gitignore
|
91
|
+
- ".gitignore"
|
92
92
|
- Gemfile
|
93
93
|
- README.md
|
94
94
|
- Rakefile
|
@@ -112,17 +112,17 @@ require_paths:
|
|
112
112
|
- lib
|
113
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: 1.3.6
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project: tuktuk
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.6.13
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: SMTP client for Ruby with DKIM support.
|