hanami-mailer 1.3.3 → 3.0.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +154 -45
- data/LICENSE +20 -0
- data/README.md +518 -303
- data/hanami-mailer.gemspec +23 -18
- data/lib/hanami/mailer/attachment.rb +133 -0
- data/lib/hanami/mailer/attachment_set.rb +38 -0
- data/lib/hanami/mailer/delivery/result.rb +101 -0
- data/lib/hanami/mailer/delivery/smtp.rb +168 -0
- data/lib/hanami/mailer/delivery/test.rb +57 -0
- data/lib/hanami/mailer/dsl/attachments.rb +108 -0
- data/lib/hanami/mailer/dsl/exposure.rb +69 -0
- data/lib/hanami/mailer/dsl/exposures.rb +111 -0
- data/lib/hanami/mailer/dsl/plucky_proc.rb +135 -0
- data/lib/hanami/mailer/errors.rb +73 -0
- data/lib/hanami/mailer/message.rb +101 -0
- data/lib/hanami/mailer/version.rb +4 -3
- data/lib/hanami/mailer/view_integration.rb +205 -0
- data/lib/hanami/mailer.rb +372 -270
- data/lib/hanami-mailer.rb +1 -1
- metadata +40 -97
- data/LICENSE.md +0 -22
- data/lib/hanami/mailer/configuration.rb +0 -310
- data/lib/hanami/mailer/dsl.rb +0 -628
- data/lib/hanami/mailer/rendering/template_name.rb +0 -55
- data/lib/hanami/mailer/rendering/templates_finder.rb +0 -135
- data/lib/hanami/mailer/template.rb +0 -42
data/lib/hanami-mailer.rb
CHANGED
metadata
CHANGED
|
@@ -1,149 +1,93 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hanami-mailer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
autorequire:
|
|
7
|
+
- Hanakai team
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: dry-configurable
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
18
|
+
version: '1.0'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: tilt
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '2.0'
|
|
34
|
-
- - ">="
|
|
35
|
-
- !ruby/object:Gem::Version
|
|
36
|
-
version: 2.0.1
|
|
37
|
-
type: :runtime
|
|
38
|
-
prerelease: false
|
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
-
requirements:
|
|
41
|
-
- - "~>"
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version: '2.0'
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: 2.0.1
|
|
25
|
+
version: '1.0'
|
|
47
26
|
- !ruby/object:Gem::Dependency
|
|
48
27
|
name: mail
|
|
49
28
|
requirement: !ruby/object:Gem::Requirement
|
|
50
29
|
requirements:
|
|
51
30
|
- - "~>"
|
|
52
31
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '2.
|
|
32
|
+
version: '2.7'
|
|
54
33
|
type: :runtime
|
|
55
34
|
prerelease: false
|
|
56
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
36
|
requirements:
|
|
58
37
|
- - "~>"
|
|
59
38
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '2.
|
|
39
|
+
version: '2.7'
|
|
61
40
|
- !ruby/object:Gem::Dependency
|
|
62
|
-
name:
|
|
41
|
+
name: zeitwerk
|
|
63
42
|
requirement: !ruby/object:Gem::Requirement
|
|
64
43
|
requirements:
|
|
65
44
|
- - ">="
|
|
66
45
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
68
|
-
|
|
69
|
-
- !ruby/object:Gem::Version
|
|
70
|
-
version: '3'
|
|
71
|
-
type: :development
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :runtime
|
|
72
48
|
prerelease: false
|
|
73
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
74
50
|
requirements:
|
|
75
51
|
- - ">="
|
|
76
52
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
78
|
-
|
|
79
|
-
- !ruby/object:Gem::Version
|
|
80
|
-
version: '3'
|
|
81
|
-
- !ruby/object:Gem::Dependency
|
|
82
|
-
name: rake
|
|
83
|
-
requirement: !ruby/object:Gem::Requirement
|
|
84
|
-
requirements:
|
|
85
|
-
- - "~>"
|
|
86
|
-
- !ruby/object:Gem::Version
|
|
87
|
-
version: '13'
|
|
88
|
-
type: :development
|
|
89
|
-
prerelease: false
|
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
91
|
-
requirements:
|
|
92
|
-
- - "~>"
|
|
93
|
-
- !ruby/object:Gem::Version
|
|
94
|
-
version: '13'
|
|
95
|
-
- !ruby/object:Gem::Dependency
|
|
96
|
-
name: rspec
|
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
|
98
|
-
requirements:
|
|
99
|
-
- - "~>"
|
|
100
|
-
- !ruby/object:Gem::Version
|
|
101
|
-
version: '3.7'
|
|
102
|
-
type: :development
|
|
103
|
-
prerelease: false
|
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
requirements:
|
|
106
|
-
- - "~>"
|
|
107
|
-
- !ruby/object:Gem::Version
|
|
108
|
-
version: '3.7'
|
|
109
|
-
- !ruby/object:Gem::Dependency
|
|
110
|
-
name: rubocop
|
|
111
|
-
requirement: !ruby/object:Gem::Requirement
|
|
112
|
-
requirements:
|
|
113
|
-
- - '='
|
|
114
|
-
- !ruby/object:Gem::Version
|
|
115
|
-
version: '0.81'
|
|
116
|
-
type: :development
|
|
117
|
-
prerelease: false
|
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
119
|
-
requirements:
|
|
120
|
-
- - '='
|
|
121
|
-
- !ruby/object:Gem::Version
|
|
122
|
-
version: '0.81'
|
|
123
|
-
description: Mail for Ruby applications and Hanami mailers
|
|
53
|
+
version: '0'
|
|
54
|
+
description: Email delivery for Hanami applications and Ruby projects.
|
|
124
55
|
email:
|
|
125
|
-
-
|
|
56
|
+
- info@hanakai.org
|
|
126
57
|
executables: []
|
|
127
58
|
extensions: []
|
|
128
|
-
extra_rdoc_files:
|
|
59
|
+
extra_rdoc_files:
|
|
60
|
+
- CHANGELOG.md
|
|
61
|
+
- LICENSE
|
|
62
|
+
- README.md
|
|
129
63
|
files:
|
|
130
64
|
- CHANGELOG.md
|
|
131
|
-
- LICENSE
|
|
65
|
+
- LICENSE
|
|
132
66
|
- README.md
|
|
133
67
|
- hanami-mailer.gemspec
|
|
134
68
|
- lib/hanami-mailer.rb
|
|
135
69
|
- lib/hanami/mailer.rb
|
|
136
|
-
- lib/hanami/mailer/
|
|
137
|
-
- lib/hanami/mailer/
|
|
138
|
-
- lib/hanami/mailer/
|
|
139
|
-
- lib/hanami/mailer/
|
|
140
|
-
- lib/hanami/mailer/
|
|
70
|
+
- lib/hanami/mailer/attachment.rb
|
|
71
|
+
- lib/hanami/mailer/attachment_set.rb
|
|
72
|
+
- lib/hanami/mailer/delivery/result.rb
|
|
73
|
+
- lib/hanami/mailer/delivery/smtp.rb
|
|
74
|
+
- lib/hanami/mailer/delivery/test.rb
|
|
75
|
+
- lib/hanami/mailer/dsl/attachments.rb
|
|
76
|
+
- lib/hanami/mailer/dsl/exposure.rb
|
|
77
|
+
- lib/hanami/mailer/dsl/exposures.rb
|
|
78
|
+
- lib/hanami/mailer/dsl/plucky_proc.rb
|
|
79
|
+
- lib/hanami/mailer/errors.rb
|
|
80
|
+
- lib/hanami/mailer/message.rb
|
|
141
81
|
- lib/hanami/mailer/version.rb
|
|
142
|
-
|
|
82
|
+
- lib/hanami/mailer/view_integration.rb
|
|
83
|
+
homepage: https://hanamirb.org
|
|
143
84
|
licenses:
|
|
144
85
|
- MIT
|
|
145
|
-
metadata:
|
|
146
|
-
|
|
86
|
+
metadata:
|
|
87
|
+
changelog_uri: https://github.com/hanami/hanami-mailer/blob/main/CHANGELOG.md
|
|
88
|
+
source_code_uri: https://github.com/hanami/hanami-mailer
|
|
89
|
+
bug_tracker_uri: https://github.com/hanami/hanami-mailer/issues
|
|
90
|
+
funding_uri: https://github.com/sponsors/hanami
|
|
147
91
|
rdoc_options: []
|
|
148
92
|
require_paths:
|
|
149
93
|
- lib
|
|
@@ -151,15 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
151
95
|
requirements:
|
|
152
96
|
- - ">="
|
|
153
97
|
- !ruby/object:Gem::Version
|
|
154
|
-
version:
|
|
98
|
+
version: '3.3'
|
|
155
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
100
|
requirements:
|
|
157
101
|
- - ">="
|
|
158
102
|
- !ruby/object:Gem::Version
|
|
159
103
|
version: '0'
|
|
160
104
|
requirements: []
|
|
161
|
-
rubygems_version: 3.
|
|
162
|
-
signing_key:
|
|
105
|
+
rubygems_version: 3.6.9
|
|
163
106
|
specification_version: 4
|
|
164
|
-
summary:
|
|
107
|
+
summary: Email delivery for Hanami applications and Ruby projects.
|
|
165
108
|
test_files: []
|
data/LICENSE.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Copyright © 2015-2021 Luca Guidi
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "set"
|
|
4
|
-
require "hanami/utils/kernel"
|
|
5
|
-
|
|
6
|
-
module Hanami
|
|
7
|
-
module Mailer
|
|
8
|
-
# Framework configuration
|
|
9
|
-
#
|
|
10
|
-
# @since 0.1.0
|
|
11
|
-
class Configuration
|
|
12
|
-
# Default root
|
|
13
|
-
#
|
|
14
|
-
# @since 0.1.0
|
|
15
|
-
# @api private
|
|
16
|
-
DEFAULT_ROOT = "."
|
|
17
|
-
|
|
18
|
-
# Default delivery method
|
|
19
|
-
#
|
|
20
|
-
# @since 0.1.0
|
|
21
|
-
# @api private
|
|
22
|
-
DEFAULT_DELIVERY_METHOD = :smtp
|
|
23
|
-
|
|
24
|
-
# Default charset
|
|
25
|
-
#
|
|
26
|
-
# @since 0.1.0
|
|
27
|
-
# @api private
|
|
28
|
-
DEFAULT_CHARSET = "UTF-8"
|
|
29
|
-
|
|
30
|
-
# @since 0.1.0
|
|
31
|
-
# @api private
|
|
32
|
-
attr_reader :mailers
|
|
33
|
-
|
|
34
|
-
# @since 0.1.0
|
|
35
|
-
# @api private
|
|
36
|
-
attr_reader :modules
|
|
37
|
-
|
|
38
|
-
# Initialize a configuration instance
|
|
39
|
-
#
|
|
40
|
-
# @return [Hanami::Mailer::Configuration] a new configuration's instance
|
|
41
|
-
#
|
|
42
|
-
# @since 0.1.0
|
|
43
|
-
def initialize
|
|
44
|
-
@namespace = Object
|
|
45
|
-
reset!
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Set the Ruby namespace where to lookup for mailers.
|
|
49
|
-
#
|
|
50
|
-
# When multiple instances of the framework are used, we want to make sure
|
|
51
|
-
# that if a `MyApp` wants a `Mailers::Signup` mailer, we are loading the
|
|
52
|
-
# right one.
|
|
53
|
-
#
|
|
54
|
-
# If not set, this value defaults to `Object`.
|
|
55
|
-
#
|
|
56
|
-
# This is part of a DSL, for this reason when this method is called with
|
|
57
|
-
# an argument, it will set the corresponding instance variable. When
|
|
58
|
-
# called without, it will return the already set value, or the default.
|
|
59
|
-
#
|
|
60
|
-
# @overload namespace(value)
|
|
61
|
-
# Sets the given value
|
|
62
|
-
# @param value [Class, Module, String] a valid Ruby namespace identifier
|
|
63
|
-
#
|
|
64
|
-
# @overload namespace
|
|
65
|
-
# Gets the value
|
|
66
|
-
# @return [Class, Module, String]
|
|
67
|
-
#
|
|
68
|
-
# @api private
|
|
69
|
-
# @since 0.1.0
|
|
70
|
-
#
|
|
71
|
-
# @example Getting the value
|
|
72
|
-
# require 'hanami/mailer'
|
|
73
|
-
#
|
|
74
|
-
# Hanami::Mailer.configuration.namespace # => Object
|
|
75
|
-
#
|
|
76
|
-
# @example Setting the value
|
|
77
|
-
# require 'hanami/mailer'
|
|
78
|
-
#
|
|
79
|
-
# Hanami::Mailer.configure do
|
|
80
|
-
# namespace 'MyApp::Mailers'
|
|
81
|
-
# end
|
|
82
|
-
def namespace(value = nil)
|
|
83
|
-
if value
|
|
84
|
-
@namespace = value
|
|
85
|
-
else
|
|
86
|
-
@namespace
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
# Set the root path where to search for templates
|
|
91
|
-
#
|
|
92
|
-
# If not set, this value defaults to the current directory.
|
|
93
|
-
#
|
|
94
|
-
# When this method is called with an argument, it will set the corresponding instance variable.
|
|
95
|
-
# When called without, it will return the already set value, or the default.
|
|
96
|
-
#
|
|
97
|
-
# @overload root(value)
|
|
98
|
-
# Sets the given value
|
|
99
|
-
# @param value [String, Pathname, #to_pathname] an object that can be
|
|
100
|
-
# coerced to Pathname
|
|
101
|
-
#
|
|
102
|
-
# @overload root
|
|
103
|
-
# Gets the value
|
|
104
|
-
# @return [Pathname]
|
|
105
|
-
#
|
|
106
|
-
# @since 0.1.0
|
|
107
|
-
#
|
|
108
|
-
# @see http://www.ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html
|
|
109
|
-
# @see http://rdoc.info/gems/hanami-utils/Hanami/Utils/Kernel#Pathname-class_method
|
|
110
|
-
#
|
|
111
|
-
# @example Getting the value
|
|
112
|
-
# require 'hanami/mailer'
|
|
113
|
-
#
|
|
114
|
-
# Hanami::Mailer.configuration.root # => #<Pathname:.>
|
|
115
|
-
#
|
|
116
|
-
# @example Setting the value
|
|
117
|
-
# require 'hanami/mailer'
|
|
118
|
-
#
|
|
119
|
-
# Hanami::Mailer.configure do
|
|
120
|
-
# root '/path/to/templates'
|
|
121
|
-
# end
|
|
122
|
-
#
|
|
123
|
-
# Hanami::Mailer.configuration.root # => #<Pathname:/path/to/templates>
|
|
124
|
-
def root(value = nil)
|
|
125
|
-
if value
|
|
126
|
-
@root = Utils::Kernel.Pathname(value).realpath
|
|
127
|
-
else
|
|
128
|
-
@root
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
# Prepare the mailers.
|
|
133
|
-
#
|
|
134
|
-
# The given block will be yielded when `Hanami::Mailer` will be included by
|
|
135
|
-
# a mailer.
|
|
136
|
-
#
|
|
137
|
-
# This method can be called multiple times.
|
|
138
|
-
#
|
|
139
|
-
# @param blk [Proc] the code block
|
|
140
|
-
#
|
|
141
|
-
# @return [void]
|
|
142
|
-
#
|
|
143
|
-
# @raise [ArgumentError] if called without passing a block
|
|
144
|
-
#
|
|
145
|
-
# @since 0.1.0
|
|
146
|
-
#
|
|
147
|
-
# @see Hanami::Mailer.configure
|
|
148
|
-
def prepare(&blk)
|
|
149
|
-
if block_given?
|
|
150
|
-
@modules.push(blk)
|
|
151
|
-
else
|
|
152
|
-
raise ArgumentError.new("Please provide a block")
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
# Add a mailer to the registry
|
|
157
|
-
#
|
|
158
|
-
# @since 0.1.0
|
|
159
|
-
# @api private
|
|
160
|
-
def add_mailer(mailer)
|
|
161
|
-
@mailers.add(mailer)
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
# Duplicate by copying the settings in a new instance.
|
|
165
|
-
#
|
|
166
|
-
# @return [Hanami::Mailer::Configuration] a copy of the configuration
|
|
167
|
-
#
|
|
168
|
-
# @since 0.1.0
|
|
169
|
-
# @api private
|
|
170
|
-
def duplicate
|
|
171
|
-
Configuration.new.tap do |c|
|
|
172
|
-
c.namespace = namespace
|
|
173
|
-
c.root = root.dup
|
|
174
|
-
c.modules = modules.dup
|
|
175
|
-
c.delivery_method = delivery_method
|
|
176
|
-
c.default_charset = default_charset
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
# Load the configuration
|
|
181
|
-
def load!
|
|
182
|
-
mailers.each { |m| m.__send__(:load!) }
|
|
183
|
-
freeze
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# Reset the configuration
|
|
187
|
-
def reset!
|
|
188
|
-
root(DEFAULT_ROOT)
|
|
189
|
-
delivery_method(DEFAULT_DELIVERY_METHOD)
|
|
190
|
-
default_charset(DEFAULT_CHARSET)
|
|
191
|
-
|
|
192
|
-
@mailers = Set.new
|
|
193
|
-
@modules = []
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
alias_method :unload!, :reset!
|
|
197
|
-
|
|
198
|
-
# Copy the configuration for the given mailer
|
|
199
|
-
#
|
|
200
|
-
# @param base [Class] the target mailer
|
|
201
|
-
#
|
|
202
|
-
# @return void
|
|
203
|
-
#
|
|
204
|
-
# @since 0.1.0
|
|
205
|
-
# @api private
|
|
206
|
-
def copy!(base)
|
|
207
|
-
modules.each do |mod|
|
|
208
|
-
base.class_eval(&mod)
|
|
209
|
-
end
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
# Specify a global delivery method for the mail gateway.
|
|
213
|
-
#
|
|
214
|
-
# It supports the following delivery methods:
|
|
215
|
-
#
|
|
216
|
-
# * Exim (<tt>:exim</tt>)
|
|
217
|
-
# * Sendmail (<tt>:sendmail</tt>)
|
|
218
|
-
# * SMTP (<tt>:smtp</tt>, for local installations)
|
|
219
|
-
# * SMTP Connection (<tt>:smtp_connection</tt>,
|
|
220
|
-
# via <tt>Net::SMTP</tt> - for remote installations)
|
|
221
|
-
# * Test (<tt>:test</tt>, for testing purposes)
|
|
222
|
-
#
|
|
223
|
-
# The default delivery method is SMTP (<tt>:smtp</tt>).
|
|
224
|
-
#
|
|
225
|
-
# Custom delivery methods can be specified by passing the class policy and
|
|
226
|
-
# a set of optional configurations. This class MUST respond to:
|
|
227
|
-
#
|
|
228
|
-
# * <tt>initialize(options = {})</tt>
|
|
229
|
-
# * <tt>deliver!(mail)<tt>
|
|
230
|
-
#
|
|
231
|
-
# @param method [Symbol, #initialize, deliver!] delivery method
|
|
232
|
-
# @param options [Hash] optional settings
|
|
233
|
-
#
|
|
234
|
-
# @return [Array] an array containing the delivery method and the optional settings as an Hash
|
|
235
|
-
#
|
|
236
|
-
# @since 0.1.0
|
|
237
|
-
#
|
|
238
|
-
# @example Setup delivery method with supported symbol
|
|
239
|
-
# require 'hanami/mailer'
|
|
240
|
-
#
|
|
241
|
-
# Hanami::Mailer.configure do
|
|
242
|
-
# delivery_method :sendmail
|
|
243
|
-
# end
|
|
244
|
-
#
|
|
245
|
-
# @example Setup delivery method with supported symbol and options
|
|
246
|
-
# require 'hanami/mailer'
|
|
247
|
-
#
|
|
248
|
-
# Hanami::Mailer.configure do
|
|
249
|
-
# delivery_method :smtp, address: "localhost", port: 1025
|
|
250
|
-
# end
|
|
251
|
-
#
|
|
252
|
-
# @example Setup custom delivery method with options
|
|
253
|
-
# require 'hanami/mailer'
|
|
254
|
-
#
|
|
255
|
-
# class MandrillDeliveryMethod
|
|
256
|
-
# def initialize(options)
|
|
257
|
-
# @options = options
|
|
258
|
-
# end
|
|
259
|
-
#
|
|
260
|
-
# def deliver!(mail)
|
|
261
|
-
# # ...
|
|
262
|
-
# end
|
|
263
|
-
# end
|
|
264
|
-
#
|
|
265
|
-
# Hanami::Mailer.configure do
|
|
266
|
-
# delivery_method MandrillDeliveryMethod,
|
|
267
|
-
# username: ENV['MANDRILL_USERNAME'],
|
|
268
|
-
# password: ENV['MANDRILL_API_KEY']
|
|
269
|
-
# end
|
|
270
|
-
def delivery_method(method = nil, options = {})
|
|
271
|
-
if method.nil?
|
|
272
|
-
@delivery_method
|
|
273
|
-
else
|
|
274
|
-
@delivery_method = [method, options]
|
|
275
|
-
end
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
# @since 0.1.0
|
|
279
|
-
def default_charset(value = nil)
|
|
280
|
-
if value.nil?
|
|
281
|
-
@default_charset
|
|
282
|
-
else
|
|
283
|
-
@default_charset = value
|
|
284
|
-
end
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
protected
|
|
288
|
-
|
|
289
|
-
# @api private
|
|
290
|
-
# @since 0.1.0
|
|
291
|
-
attr_writer :root
|
|
292
|
-
|
|
293
|
-
# @api private
|
|
294
|
-
# @since 0.1.0
|
|
295
|
-
attr_writer :delivery_method
|
|
296
|
-
|
|
297
|
-
# @api private
|
|
298
|
-
# @since 0.1.0
|
|
299
|
-
attr_writer :default_charset
|
|
300
|
-
|
|
301
|
-
# @api private
|
|
302
|
-
# @since 0.1.0
|
|
303
|
-
attr_writer :namespace
|
|
304
|
-
|
|
305
|
-
# @api private
|
|
306
|
-
# @since 0.1.0
|
|
307
|
-
attr_writer :modules
|
|
308
|
-
end
|
|
309
|
-
end
|
|
310
|
-
end
|