appmail-mailgem 1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 38d513e0a9ae4f3a88821bcc2af68645ebe5839f
4
+ data.tar.gz: 16ec8f963a31bdc2e5cf8ebe33398814ee1d1ea4
5
+ SHA512:
6
+ metadata.gz: ef3babffed82c580f3aba2c58b9649c17460b4c38b59342ab65fc10f6906c5ed8de8d141228e43e323d846ac40b200c9a220c7ddc9dd229ac30de4929daaf7c0
7
+ data.tar.gz: 492232fb2c8b266c6fb2ac079f20df61f228f5be9dc908fafb8fcc61c9187f4ec4256fd0fb51385e0d02d12720ca9ff0511da2e38db59b5e1c7c295395eaf49e
@@ -0,0 +1,29 @@
1
+ require 'mail/configuration'
2
+ require 'app_mail/mail_gem/delivery_method'
3
+
4
+ module AppMail
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_appmail, :lookup_delivery_method
15
+ alias_method :lookup_delivery_method, :lookup_delivery_method_with_appmail
16
+ end
17
+ end
18
+
19
+ def lookup_delivery_method_with_appmail(method)
20
+ if method == :appmail
21
+ DeliveryMethod
22
+ else
23
+ lookup_delivery_method_without_appmail(method)
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,33 @@
1
+ require 'app_mail/client'
2
+
3
+ module AppMail
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 ||= AppMail::Client.new(@settings[:host] || "api.appmail.io", @settings[:server_key] || ENV['APPMAIL_KEY'])
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,5 @@
1
+ module AppMail
2
+ module MailGem
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require 'app_mail/mail_gem/config_extension'
2
+ AppMail::MailGem::ConfigExtension.load
3
+ require 'app_mail/mail_gem/delivery_method'
4
+
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appmail-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: 2016-11-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appmail
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 AppMail with the Ruby mail gem
48
+ email:
49
+ - me@adamcooke.io
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - lib/app_mail/mail_gem/config_extension.rb
55
+ - lib/app_mail/mail_gem/delivery_method.rb
56
+ - lib/app_mail/mail_gem/version.rb
57
+ - lib/appmail-mailgem.rb
58
+ homepage: https://appmail.io
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 AppMail with the Ruby mail gem
82
+ test_files: []