tuktuk 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -1
- data/bin/tuktuk +61 -0
- data/lib/tuktuk/tuktuk.rb +9 -3
- data/lib/tuktuk/version.rb +2 -2
- data/lib/tuktuk.rb +1 -1
- metadata +78 -95
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2537bbe4a21520034c1c224b03c8a1969d5ab5bc
|
4
|
+
data.tar.gz: b3c980a8467cfdecd7dd5c077c2466f89fec3669
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e926584a25e528c86808aa8ad6b70c4c5ae39a9bd38e902c39eecbb4e36e3c276471a7c022180fc17bb53001ab98e5696f54ef64e22d1af48a0ae1d34241e8fa
|
7
|
+
data.tar.gz: 47914f0eeb2bb7c9b5a6b117f9366cae4f5b0024f7d2c7772581be83aa36ec1ef98ce22177149c3cfe63f48adb87f096cab80dd47a80a443905927e64b2a9438
|
data/README.md
CHANGED
@@ -39,6 +39,8 @@ else
|
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
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. 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.
|
43
|
+
|
42
44
|
Delivering multiple
|
43
45
|
-------------------
|
44
46
|
|
@@ -85,7 +87,7 @@ message = { ... }
|
|
85
87
|
response, email = Tuktuk.deliver(message)
|
86
88
|
```
|
87
89
|
|
88
|
-
For DKIM to work, you need to set up some TXT records in your domain's DNS. You can use [this tool](http://www.socketlabs.com/domainkey-dkim-generation-wizard/) to generate the key. You should also create [SPF records](http://www.spfwizard.net/) if you haven't.
|
90
|
+
For DKIM to work, you need to set up some TXT records in your domain's DNS. You can use [this tool](http://www.socketlabs.com/domainkey-dkim-generation-wizard/) to generate the key. You should also create [SPF records](http://www.spfwizard.net/) if you haven't. Then use [this tool](https://www.mail-tester.com/spf-dkim-check) to verify that they're both correctly in place.
|
89
91
|
|
90
92
|
All available options, with their defaults:
|
91
93
|
|
data/bin/tuktuk
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/tuktuk'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
def missing_keys?(opts)
|
7
|
+
[:body, :from, :subject, :to] - opts.keys
|
8
|
+
end
|
9
|
+
|
10
|
+
options = {}
|
11
|
+
|
12
|
+
OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: tuktuk [options]"
|
14
|
+
|
15
|
+
opts.on("-f", "--from your@email.com", String, "From email") do |val|
|
16
|
+
options[:from] = val
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-t", "--to email1,email2", Array, "List of destination emails") do |list|
|
20
|
+
options[:to] = list
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("-s","--subject 'This is a test.'", String, "Email subject") do |subject|
|
24
|
+
options[:subject] = subject
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on("-b", "--body 'Hello there.'", String, "Email body") do |body|
|
28
|
+
options[:body] = body
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
32
|
+
puts opts
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on_tail("-v", "--version", "Show version") do
|
37
|
+
puts Tuktuk::VERSION
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
|
41
|
+
end.parse!
|
42
|
+
|
43
|
+
if list = missing_keys?(options) and list.any?
|
44
|
+
puts "Missing option(s): #{list.join(', ')}"
|
45
|
+
puts "Run with -h or --help for all options."
|
46
|
+
exit
|
47
|
+
end
|
48
|
+
|
49
|
+
Tuktuk.options = {
|
50
|
+
:max_workers => 0,
|
51
|
+
:log_to => STDOUT
|
52
|
+
}
|
53
|
+
|
54
|
+
response, email = Tuktuk.deliver(options)
|
55
|
+
|
56
|
+
if response.is_a?(Tuktuk::Bounce)
|
57
|
+
puts 'Email bounced. Type: ' + response.class.name # => HardBounce or SoftBounce
|
58
|
+
puts response.message
|
59
|
+
else
|
60
|
+
puts 'Email delivered!'
|
61
|
+
end
|
data/lib/tuktuk/tuktuk.rb
CHANGED
@@ -5,8 +5,8 @@ require 'work_queue'
|
|
5
5
|
|
6
6
|
module Tuktuk; end
|
7
7
|
|
8
|
-
%w(package cache dns bounce).each { |lib|
|
9
|
-
|
8
|
+
%w(package cache dns bounce).each { |lib| require_relative "./#{lib}" }
|
9
|
+
require_relative './version' unless defined?(Tuktuk::VERSION)
|
10
10
|
|
11
11
|
DEFAULTS = {
|
12
12
|
:helo_domain => nil,
|
@@ -38,7 +38,11 @@ module Tuktuk
|
|
38
38
|
def deliver!(mail)
|
39
39
|
@logger = Rails.logger if defined?(Rails) and !config[:log_to]
|
40
40
|
resp, email = deliver(mail)
|
41
|
-
|
41
|
+
if resp.is_a?(Exception)
|
42
|
+
raise resp
|
43
|
+
else
|
44
|
+
return resp, email
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
def deliver_many(messages, opts = {})
|
@@ -112,6 +116,8 @@ module Tuktuk
|
|
112
116
|
mail.destinations.each do |to|
|
113
117
|
|
114
118
|
domain = get_domain(to)
|
119
|
+
raise "Empty domain: #{domain}" if domain.blank?
|
120
|
+
|
115
121
|
unless servers = smtp_servers_for_domain(domain)
|
116
122
|
return HardBounce.new("588 No MX records for domain #{domain}")
|
117
123
|
end
|
data/lib/tuktuk/version.rb
CHANGED
data/lib/tuktuk.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'tuktuk/tuktuk'
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/tuktuk/tuktuk'
|
metadata
CHANGED
@@ -1,105 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuktuk
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 5
|
8
|
-
- 4
|
9
|
-
version: 0.5.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
6
|
+
authors:
|
7
|
+
- Tomás Pollak
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: bundler
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 0
|
30
|
-
- 0
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
31
19
|
version: 1.0.0
|
32
20
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: net-dns
|
36
21
|
prerelease: false
|
37
|
-
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-dns
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
45
33
|
version: 0.6.1
|
46
34
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: mail
|
50
35
|
prerelease: false
|
51
|
-
|
52
|
-
requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mail
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
53
45
|
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
- 2
|
57
|
-
- 3
|
58
|
-
version: "2.3"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.3'
|
59
48
|
type: :runtime
|
60
|
-
version_requirements: *id003
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: dkim
|
63
49
|
prerelease: false
|
64
|
-
|
65
|
-
requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
66
52
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dkim
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
72
61
|
version: 0.0.2
|
73
62
|
type: :runtime
|
74
|
-
version_requirements: *id004
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: work_queue
|
77
63
|
prerelease: false
|
78
|
-
|
79
|
-
requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
80
66
|
- - ~>
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.0.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: work_queue
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
86
75
|
version: 2.5.0
|
87
76
|
type: :runtime
|
88
|
-
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.5.0
|
89
83
|
description: Easy way of sending DKIM-signed emails from Ruby, no dependencies needed.
|
90
|
-
email:
|
84
|
+
email:
|
91
85
|
- tomas@forkhq.com
|
92
|
-
executables:
|
93
|
-
|
86
|
+
executables:
|
87
|
+
- tuktuk
|
94
88
|
extensions: []
|
95
|
-
|
96
89
|
extra_rdoc_files: []
|
97
|
-
|
98
|
-
files:
|
90
|
+
files:
|
99
91
|
- .gitignore
|
100
92
|
- Gemfile
|
101
93
|
- README.md
|
102
94
|
- Rakefile
|
95
|
+
- bin/tuktuk
|
103
96
|
- lib/tuktuk.rb
|
104
97
|
- lib/tuktuk/bounce.rb
|
105
98
|
- lib/tuktuk/cache.rb
|
@@ -110,37 +103,27 @@ files:
|
|
110
103
|
- lib/tuktuk/version.rb
|
111
104
|
- spec/deliver_spec.rb
|
112
105
|
- tuktuk.gemspec
|
113
|
-
has_rdoc: true
|
114
106
|
homepage: https://github.com/tomas/tuktuk
|
115
107
|
licenses: []
|
116
|
-
|
108
|
+
metadata: {}
|
117
109
|
post_install_message:
|
118
110
|
rdoc_options: []
|
119
|
-
|
120
|
-
require_paths:
|
111
|
+
require_paths:
|
121
112
|
- lib
|
122
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- -
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
segments:
|
134
|
-
- 1
|
135
|
-
- 3
|
136
|
-
- 6
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
137
122
|
version: 1.3.6
|
138
123
|
requirements: []
|
139
|
-
|
140
124
|
rubyforge_project: tuktuk
|
141
|
-
rubygems_version:
|
125
|
+
rubygems_version: 2.0.2
|
142
126
|
signing_key:
|
143
|
-
specification_version:
|
127
|
+
specification_version: 4
|
144
128
|
summary: SMTP client for Ruby with DKIM support.
|
145
129
|
test_files: []
|
146
|
-
|