postal-mailgem 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/postal-mailgem.rb +4 -0
- data/lib/postal/mail_gem/config_extension.rb +29 -0
- data/lib/postal/mail_gem/delivery_method.rb +33 -0
- data/lib/postal/mail_gem/version.rb +5 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3fe13fe53cde2b71385df8995dace00517965454
|
4
|
+
data.tar.gz: 5e22254d36916f0c753ad127cd554daa17939fb9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71011e84eb62a8cf3161fdd77d8a86bd2f51f9ba1b46de4c5baaeaef43f19b4538cf9878694546eb833d9594b425ec21bbb70e9dbdab8d940231a15a62151570
|
7
|
+
data.tar.gz: dcfe0376f8cf818844d8dc9375f114b599e900a6ade5172ff4f807bbe581fa315cf2d618e7e57b3fd45e12af1e04902e2ec82f468038252884ad9823f894cb38
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'mail/configuration'
|
2
|
+
require 'postal/mail_gem/delivery_method'
|
3
|
+
|
4
|
+
module Postal
|
5
|
+
module MailGem
|
6
|
+
module ConfigExtension
|
7
|
+
|
8
|
+
def self.load
|
9
|
+
Mail::Configuration.send :include, self
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.included(base)
|
13
|
+
base.class_eval do
|
14
|
+
alias_method :lookup_delivery_method_without_postal, :lookup_delivery_method
|
15
|
+
alias_method :lookup_delivery_method, :lookup_delivery_method_with_postal
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def lookup_delivery_method_with_postal(method)
|
20
|
+
if method == :postal
|
21
|
+
DeliveryMethod
|
22
|
+
else
|
23
|
+
lookup_delivery_method_without_postal(method)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'postal/client'
|
2
|
+
|
3
|
+
module Postal
|
4
|
+
module MailGem
|
5
|
+
class DeliveryMethod
|
6
|
+
|
7
|
+
def initialize(settings)
|
8
|
+
@settings = settings
|
9
|
+
end
|
10
|
+
|
11
|
+
def settings
|
12
|
+
@settings
|
13
|
+
end
|
14
|
+
|
15
|
+
def deliver!(message)
|
16
|
+
client.send_raw_message do |m|
|
17
|
+
m.mail_from(message.from.first)
|
18
|
+
[message.to, message.cc, message.bcc].flatten.compact.uniq.each do |address|
|
19
|
+
m.rcpt_to(address)
|
20
|
+
end
|
21
|
+
m.data(message.to_s)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def client
|
28
|
+
@client ||= Postal::Client.new(@settings[:host] || ENV['POSTAL_HOST'], @settings[:server_key] || ENV['POSTAL_KEY'])
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: postal-mailgem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Cooke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: postal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.2
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.2
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: mail
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: Use Postal with the Ruby mail gem
|
48
|
+
email:
|
49
|
+
- me@adamcooke.io
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- lib/postal-mailgem.rb
|
55
|
+
- lib/postal/mail_gem/config_extension.rb
|
56
|
+
- lib/postal/mail_gem/delivery_method.rb
|
57
|
+
- lib/postal/mail_gem/version.rb
|
58
|
+
homepage: https://github.com/atech/postal
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.5.1
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Use Postal with the Ruby mail gem
|
82
|
+
test_files: []
|
83
|
+
has_rdoc:
|