open_mailer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +40 -0
- data/Rakefile +3 -0
- data/lib/open_mailer.rb +5 -0
- data/lib/open_mailer/delivery_method.rb +18 -0
- data/lib/open_mailer/railtie.rb +12 -0
- data/lib/open_mailer/version.rb +3 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f7d7dba6ddcf59e4bfefd790d67e94d3136505c485c376bf7de73d72c2cc2c4a
|
4
|
+
data.tar.gz: dee3286ffc04d14c1a0d967549d38dfe957c8118cdd5fa1cefe4fd81363fe555
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c660c10069c4f5a5835da3b5b5449c8847c6f3093970c61066573854642c41ce0b9b05a8cb34885e1e263c95e0e06530a937ae884c3fa05cdcb1be8d437d7c7b
|
7
|
+
data.tar.gz: 3cd1cf0a185ec4fa47db05adf00898bfddfd261e57c2a1b2fa0984ea2246c31683b4d1307d82ac91f63e9ec46292991d3e883b393280297f555478a5cc13b353
|
data/CHANGELOG.md
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2021 Tyler Hunt
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# OpenMailer
|
2
|
+
|
3
|
+
An Action Mailer delivery method that opens emails locally.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
When delivering emails, they will be opened using your system’s default email
|
8
|
+
client (e.g. Mail.app under macOS) without ever actually being sent.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's `Gemfile`:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'open_mailer', group: :development
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
```bash
|
21
|
+
bundle
|
22
|
+
```
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
```bash
|
27
|
+
gem install open_mailer
|
28
|
+
```
|
29
|
+
|
30
|
+
Then add the following line to the `config/environments/development.rb` file in
|
31
|
+
a Rails app:
|
32
|
+
|
33
|
+
```
|
34
|
+
config.action_mailer.delivery_method = :letter_opener
|
35
|
+
```
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the
|
40
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/open_mailer.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'launchy'
|
2
|
+
require 'mail/check_delivery_params'
|
3
|
+
|
4
|
+
module OpenMailer
|
5
|
+
class DeliveryMethod
|
6
|
+
attr_accessor :settings
|
7
|
+
|
8
|
+
def initialize(**settings)
|
9
|
+
self.settings = settings
|
10
|
+
end
|
11
|
+
|
12
|
+
def deliver!(mail)
|
13
|
+
Mail::CheckDeliveryParams.check mail
|
14
|
+
file = Tempfile.open(['', '.eml']) { |file| file << mail }
|
15
|
+
Launchy.open file.path
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'action_mailer'
|
2
|
+
require 'rails/railtie'
|
3
|
+
|
4
|
+
require_relative 'delivery_method'
|
5
|
+
|
6
|
+
module OpenMailer
|
7
|
+
class Railtie < ::Rails::Railtie
|
8
|
+
initializer 'open_mailer.delivery_method' do
|
9
|
+
ActionMailer::Base.add_delivery_method :open_mailer, DeliveryMethod
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: open_mailer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tyler Hunt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: launchy
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mail
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- tyler@tylerhunt.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- CHANGELOG.md
|
63
|
+
- MIT-LICENSE
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- lib/open_mailer.rb
|
67
|
+
- lib/open_mailer/delivery_method.rb
|
68
|
+
- lib/open_mailer/railtie.rb
|
69
|
+
- lib/open_mailer/version.rb
|
70
|
+
homepage: https://github.com/tylerhunt/open_mailer
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata:
|
74
|
+
homepage_uri: https://github.com/tylerhunt/open_mailer
|
75
|
+
source_code_uri: https://github.com/tylerhunt/open_mailer
|
76
|
+
changelog_uri: https://github.com/tylerhunt/open_mailer/blob/master/CHANGELOG.md
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubygems_version: 3.1.4
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: An Action Mailer delivery method that opens emails locally.
|
96
|
+
test_files: []
|