mailsocio_rails 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +55 -0
- data/Rakefile +2 -0
- data/lib/mailsocio_rails/delivery.rb +43 -0
- data/lib/mailsocio_rails/version.rb +3 -0
- data/lib/mailsocio_rails.rb +8 -0
- data/mailsocio_rails.gemspec +25 -0
- metadata +156 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6a75e8ff2ed1d5344a797f16d0ab268453d890af
|
4
|
+
data.tar.gz: a07994c2e18aa9e8a1e66ca5b45f351f4b743ec5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0990a84ed8af1d6d7037c2e18288523d0e595092223e18d451a199391a2d80e4f1abf8b337bf21c1ad3928797713414024303a9acb8217b1181454402a254bc7
|
7
|
+
data.tar.gz: 628cea7c4cef60a12330dedffe86cf15ebfbe9d93aeb89ceed7c83371eb84515c7055f4cf5c4f1753ca0727f10581603f14feaded75515acf6d3e5514752c047
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Anahoret Team
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Mailsocio Rails
|
2
|
+
|
3
|
+
ActionMailer plugin to use mailsocio to deliver emails
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'mailsocio_rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute `bundle`.
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Configure ActionMailer as follows:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
# config/application.rb
|
21
|
+
|
22
|
+
config.action_mailer.delivery_method = :mailsocio
|
23
|
+
config.action_mailer.mailsocio_settings = {
|
24
|
+
account_id: '<your account id>',
|
25
|
+
api_key: '<your account api key>'
|
26
|
+
}
|
27
|
+
```
|
28
|
+
|
29
|
+
You're done!
|
30
|
+
|
31
|
+
## Customization
|
32
|
+
|
33
|
+
You can also override gem defaults:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
config.action_mailer.mailsocio_settings = {
|
37
|
+
account_id: '<your account id>',
|
38
|
+
api_key: '<your account api key>',
|
39
|
+
|
40
|
+
address: 'app.mailarbor.com', # This can be any smtp server
|
41
|
+
port: 25, # that is capable to
|
42
|
+
domain: 'localhost.localdomain' # deliver emails.
|
43
|
+
|
44
|
+
mailsocio_recipient: 'submit@app.mailarbor.com', # If you change this,
|
45
|
+
# bad things can happen.
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
1. Fork it ( https://github.com/[my-github-username]/mailsocio_rails/fork )
|
52
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
53
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
54
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
55
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'mail'
|
2
|
+
|
3
|
+
module MailsocioRails
|
4
|
+
class Delivery < ::Mail::SMTP
|
5
|
+
attr_accessor :settings
|
6
|
+
def initialize(settings)
|
7
|
+
self.settings = default_settings.merge settings
|
8
|
+
end
|
9
|
+
|
10
|
+
def deliver!(mail)
|
11
|
+
addrs = addresses_from mail, :to, :cc
|
12
|
+
bcc = mail[:bcc].to_s
|
13
|
+
|
14
|
+
mail.to = settings[:mailsocio_recipient]
|
15
|
+
mail.cc = nil
|
16
|
+
mail.bcc = nil
|
17
|
+
|
18
|
+
mail['X-To'] = Hash[addrs.map {|(addr, name)| [addr, {'name' => name}]}].to_json
|
19
|
+
mail['X-Bcc'] = bcc
|
20
|
+
mail['X-Account-Id'] = settings[:account_id]
|
21
|
+
mail['X-Api-Key'] = settings[:api_key]
|
22
|
+
|
23
|
+
super(mail)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def default_settings
|
29
|
+
{
|
30
|
+
address: 'app.mailarbor.com',
|
31
|
+
port: 25,
|
32
|
+
mailsocio_recipient: 'submit@app.mailarbor.com',
|
33
|
+
domain: 'localhost.localdomain'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def addresses_from(mail, *methods)
|
38
|
+
methods.flat_map { |method|
|
39
|
+
(mail.send(method) || []).zip(mail[method].try(:display_names) || [])
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mailsocio_rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mailsocio_rails"
|
8
|
+
spec.version = MailsocioRails::VERSION
|
9
|
+
spec.authors = ["Anahoret team"]
|
10
|
+
spec.email = ["dmitriy.kiriyenko@anahoret.com"]
|
11
|
+
spec.summary = %q{ActionMailer plugin to use mailsocio to deliver emails}
|
12
|
+
spec.description = File.read(File.expand_path(File.join(File.dirname(__FILE__), 'README.md')))
|
13
|
+
spec.homepage = "http://app.mailarbor.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'actionmailer', '>=3.2', '<5'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mailsocio_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anahoret team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionmailer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.7'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.7'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '10.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '10.0'
|
61
|
+
description: |
|
62
|
+
# Mailsocio Rails
|
63
|
+
|
64
|
+
ActionMailer plugin to use mailsocio to deliver emails
|
65
|
+
|
66
|
+
## Installation
|
67
|
+
|
68
|
+
Add this line to your application's Gemfile:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
gem 'mailsocio_rails'
|
72
|
+
```
|
73
|
+
|
74
|
+
And then execute `bundle`.
|
75
|
+
|
76
|
+
## Usage
|
77
|
+
|
78
|
+
Configure ActionMailer as follows:
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
# config/application.rb
|
82
|
+
|
83
|
+
config.action_mailer.delivery_method = :mailsocio
|
84
|
+
config.action_mailer.mailsocio_settings = {
|
85
|
+
account_id: '<your account id>',
|
86
|
+
api_key: '<your account api key>'
|
87
|
+
}
|
88
|
+
```
|
89
|
+
|
90
|
+
You're done!
|
91
|
+
|
92
|
+
## Customization
|
93
|
+
|
94
|
+
You can also override gem defaults:
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
config.action_mailer.mailsocio_settings = {
|
98
|
+
account_id: '<your account id>',
|
99
|
+
api_key: '<your account api key>',
|
100
|
+
|
101
|
+
address: 'app.mailarbor.com', # This can be any smtp server
|
102
|
+
port: 25, # that is capable to
|
103
|
+
domain: 'localhost.localdomain' # deliver emails.
|
104
|
+
|
105
|
+
mailsocio_recipient: 'submit@app.mailarbor.com', # If you change this,
|
106
|
+
# bad things can happen.
|
107
|
+
}
|
108
|
+
```
|
109
|
+
|
110
|
+
## Contributing
|
111
|
+
|
112
|
+
1. Fork it ( https://github.com/[my-github-username]/mailsocio_rails/fork )
|
113
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
114
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
115
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
116
|
+
5. Create a new Pull Request
|
117
|
+
email:
|
118
|
+
- dmitriy.kiriyenko@anahoret.com
|
119
|
+
executables: []
|
120
|
+
extensions: []
|
121
|
+
extra_rdoc_files: []
|
122
|
+
files:
|
123
|
+
- ".gitignore"
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- lib/mailsocio_rails.rb
|
129
|
+
- lib/mailsocio_rails/delivery.rb
|
130
|
+
- lib/mailsocio_rails/version.rb
|
131
|
+
- mailsocio_rails.gemspec
|
132
|
+
homepage: http://app.mailarbor.com
|
133
|
+
licenses:
|
134
|
+
- MIT
|
135
|
+
metadata: {}
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 2.4.5
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: ActionMailer plugin to use mailsocio to deliver emails
|
156
|
+
test_files: []
|