SimpleMail 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/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +49 -0
- data/SimpleMail.gemspec +37 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/SimpleMail.rb +235 -0
- data/lib/SimpleMail/version.rb +3 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fd9929cf1be214e3ce19cc9e6ffe63ff74f6c03d
|
4
|
+
data.tar.gz: 609ea8d33a94d862be27933b5189fccfdb035bf8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b3796ac71f92d284c895d34336ef6d8215c95d5e0257b4e7d2574da302679b1cdc9e63f74d4da0ea0d81d18a0fdcbba12b6341911d28c6590a8f22a6fae68b6
|
7
|
+
data.tar.gz: d14eac2cebe18dae35c81e859bebd8438acf25817519bf93c7badcc77ef1d868fc5bfb85750548ac755a8783e47fa46cf379506c22450b3f9515ae5392580026
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at saroar9@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 saroar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# SimpleMail
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/SimpleMail`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'SimpleMail'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install SimpleMail
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/SimpleMail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the SimpleMail project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/SimpleMail/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
require 'json'
|
6
|
+
require 'uri'
|
7
|
+
|
8
|
+
desc "Run all specs"
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
|
+
|
12
|
+
task :default => :spec
|
13
|
+
|
14
|
+
|
15
|
+
######################################################
|
16
|
+
|
17
|
+
require 'rake'
|
18
|
+
require 'rake/clean'
|
19
|
+
require 'rubygems'
|
20
|
+
require 'rubygems/package_task'
|
21
|
+
require 'fileutils'
|
22
|
+
|
23
|
+
|
24
|
+
Gem::PackageTask.new(eval File.read('SimpleMail.gemspec')) do |p|
|
25
|
+
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
|
26
|
+
end
|
27
|
+
|
28
|
+
task :install => [ :package ] do
|
29
|
+
sh %{sudo gem install pkg/#{name}-#{version}.gem}
|
30
|
+
end
|
31
|
+
|
32
|
+
task :uninstall => [ :clean ] do
|
33
|
+
sh %{sudo gem uninstall #{name}}
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Print all authors from git history"
|
37
|
+
task :authors do
|
38
|
+
token = `cat ~/.github_token`.chomp
|
39
|
+
authors = `git log |grep Author |cut -f 1 -d'<' |cut -f2 -d':' |sort -u`
|
40
|
+
authors.split(/\n/).each do |a|
|
41
|
+
print "* #{a} "
|
42
|
+
ainfo = JSON.parse `curl -u #{token}:x-oauth-basic --silent https://api.github.com/search/users?q=#{URI.encode a}`
|
43
|
+
puts ainfo unless ainfo['total_count']
|
44
|
+
(puts; next) unless ainfo && ainfo['total_count'] > 0
|
45
|
+
puts "[@#{ainfo['items'][0]['login']}](#{ainfo['items'][0]['html_url']})"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
CLEAN.include [ 'pkg', '*.gem', '.config' ]
|
data/SimpleMail.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "SimpleMail/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "SimpleMail"
|
8
|
+
spec.version = SimpleMail::VERSION
|
9
|
+
spec.authors = ["saroar"]
|
10
|
+
spec.email = ["saroar9@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Simple gem for sending email notification}
|
13
|
+
spec.description = %q{Very Simple gem for send mail}
|
14
|
+
spec.homepage = "https://github.com/saroar/SimpleMail.git"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_runtime_dependency 'mail', '>= 2.0'
|
37
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "SimpleMail"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/SimpleMail.rb
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
require "SimpleMail/version"
|
2
|
+
require 'mail'
|
3
|
+
require 'base64'
|
4
|
+
require 'socket'
|
5
|
+
|
6
|
+
module SimpleMail
|
7
|
+
@@options = {}
|
8
|
+
@@override_options = {}
|
9
|
+
@@subject_prefix = false
|
10
|
+
@@append_inputs = false
|
11
|
+
|
12
|
+
# Default options can be set so that they don't have to be repeated.
|
13
|
+
#
|
14
|
+
# SimpleMail.options = { :from => 'noreply@example.com', :via => :smtp, :via_options => { :host => 'smtp.yourserver.com' } }
|
15
|
+
# SimpleMail.mail(:to => 'foo@bar') # Sends mail to foo@bar from noreply@example.com using smtp
|
16
|
+
# SimpleMail.mail(:from => 'simple_mail@example.com', :to => 'foo@bar') # Sends mail to foo@bar from simple_mail@example.com using smtp
|
17
|
+
def self.options=(value)
|
18
|
+
@@options = value
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.options()
|
22
|
+
@@options
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.override_options=(value)
|
26
|
+
@@override_options = value
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.override_options
|
30
|
+
@@override_options
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.subject_prefix(value)
|
34
|
+
@@subject_prefix = value
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.append_inputs
|
38
|
+
@@append_inputs = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# Send an email
|
42
|
+
# SimpleMail.mail(:to => 'you@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Hello there.')
|
43
|
+
# SimpleMail.mail(:to => 'you@example.com', :html_body => '<h1>Hello there!</h1>', :body => "In case you can't read html, Hello there.")
|
44
|
+
# SimpleMail.mail(:to => 'you@example.com', :cc => 'him@example.com', :from => 'me@example.com', :subject => 'hi', :body => 'Howsit!')
|
45
|
+
def self.mail(options)
|
46
|
+
if @@append_inputs
|
47
|
+
options[:body] = "#{options[:body]}/n #{options.to_s}"
|
48
|
+
end
|
49
|
+
|
50
|
+
options = @@options.merge options
|
51
|
+
options = options.merge @@override_options
|
52
|
+
|
53
|
+
if @@subject_prefix
|
54
|
+
options[:subject] = "#{@@subject_prefix}#{options[:subject]}"
|
55
|
+
end
|
56
|
+
|
57
|
+
fail ArgumentError, ':to is required' unless options[:to]
|
58
|
+
|
59
|
+
options[:via] = default_delivery_method unless options.key?(:via)
|
60
|
+
|
61
|
+
if options.key?(:via) && options[:via] == :sendmail
|
62
|
+
options[:via_options] ||= {}
|
63
|
+
options[:via_options][:location] ||= sendmail_binary
|
64
|
+
end
|
65
|
+
|
66
|
+
deliver build_mail(options)
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.permissable_options
|
70
|
+
standard_options + non_standard_options
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def self.deliver(mail)
|
76
|
+
mail.deliver!
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.default_delivery_method
|
80
|
+
File.executable?(sendmail_binary) ? :sendmail : :smtp
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.standard_options
|
84
|
+
[
|
85
|
+
:to,
|
86
|
+
:cc,
|
87
|
+
:bcc,
|
88
|
+
:from,
|
89
|
+
:subject,
|
90
|
+
:content_type,
|
91
|
+
:message_id,
|
92
|
+
:sender,
|
93
|
+
:reply_to,
|
94
|
+
:smtp_envelope_to
|
95
|
+
]
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.non_standard_options
|
99
|
+
[
|
100
|
+
:attachments,
|
101
|
+
:body,
|
102
|
+
:charset,
|
103
|
+
:enable_starttls_auto,
|
104
|
+
:headers,
|
105
|
+
:html_body,
|
106
|
+
:text_part_charset,
|
107
|
+
:via,
|
108
|
+
:via_options,
|
109
|
+
:body_part_header,
|
110
|
+
:html_body_part_header
|
111
|
+
]
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.build_mail(options)
|
115
|
+
mail = Mail.new do |m|
|
116
|
+
options[:date] ||= Time.now
|
117
|
+
options[:from] ||= 'simple_mail@unknown'
|
118
|
+
options[:via_options] ||= {}
|
119
|
+
|
120
|
+
options.each do |k, v|
|
121
|
+
next if SimpleMail.non_standard_options.include?(k)
|
122
|
+
m.send(k, v)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Automatic handling of multipart messages in the underlying
|
126
|
+
# mail library works pretty well for the most part, but in
|
127
|
+
# the case where we have attachments AND text AND html bodies
|
128
|
+
# we need to explicitly define a second multipart/alternative
|
129
|
+
# boundary to encapsulate the body-parts within the
|
130
|
+
# multipart/mixed boundary that will be created automatically.
|
131
|
+
if options[:attachments] && options[:html_body] && options[:body]
|
132
|
+
part(:content_type => 'multipart/alternative') do |p|
|
133
|
+
p.html_part = SimpleMail.build_html_part(options)
|
134
|
+
p.text_part = SimpleMail.build_text_part(options)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Otherwise if there is more than one part we still need to
|
138
|
+
# ensure that they are all declared to be separate.
|
139
|
+
elsif options[:html_body] || options[:attachments]
|
140
|
+
if options[:html_body]
|
141
|
+
m.html_part = SimpleMail.build_html_part(options)
|
142
|
+
end
|
143
|
+
|
144
|
+
if options[:body]
|
145
|
+
m.text_part = SimpleMail.build_text_part(options)
|
146
|
+
end
|
147
|
+
|
148
|
+
# If all we have is a text body, we don't need to worry about parts.
|
149
|
+
elsif options[:body]
|
150
|
+
body options[:body]
|
151
|
+
end
|
152
|
+
|
153
|
+
delivery_method options[:via], options[:via_options]
|
154
|
+
end
|
155
|
+
|
156
|
+
(options[:headers] ||= {}).each do |key, value|
|
157
|
+
mail[key] = value
|
158
|
+
end
|
159
|
+
|
160
|
+
add_attachments(mail, options[:attachments]) if options[:attachments]
|
161
|
+
|
162
|
+
mail.charset = options[:charset] if options[:charset] # charset must be set after setting content_type
|
163
|
+
|
164
|
+
if mail.multipart? && options[:text_part_charset]
|
165
|
+
mail.text_part.charset = options[:text_part_charset]
|
166
|
+
end
|
167
|
+
set_content_type(mail, options[:content_type])
|
168
|
+
mail
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.build_html_part(options)
|
172
|
+
Mail::Part.new(:content_type => 'text/html;charset=UTF-8') do
|
173
|
+
content_transfer_encoding 'quoted-printable'
|
174
|
+
body Mail::Encodings::QuotedPrintable.encode(options[:html_body])
|
175
|
+
if options[:html_body_part_header] && options[:html_body_part_header].is_a?(Hash)
|
176
|
+
options[:html_body_part_header].each do |k,v|
|
177
|
+
header[k] = v
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def self.build_text_part(options)
|
184
|
+
Mail::Part.new(:content_type => 'text/plain') do
|
185
|
+
content_type options[:charset] if options[:charset]
|
186
|
+
body options[:body]
|
187
|
+
if options[:body_part_header] && options[:body_part_header].is_a?(Hash)
|
188
|
+
options[:body_part_header].each do |k,v|
|
189
|
+
header[k] = v
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def self.set_content_type(mail, user_content_type)
|
196
|
+
params = mail.content_type_parameters || {}
|
197
|
+
content_type = case
|
198
|
+
when user_content_type
|
199
|
+
user_content_type
|
200
|
+
when mail.has_attachments?
|
201
|
+
if mail.attachments.detect { |a| a.inline? }
|
202
|
+
["multipart", "related", params]
|
203
|
+
else
|
204
|
+
["multipart", "mixed", params]
|
205
|
+
end
|
206
|
+
when mail.multipart?
|
207
|
+
["multipart", "alternative", params]
|
208
|
+
else
|
209
|
+
false
|
210
|
+
end
|
211
|
+
mail.content_type = content_type if content_type
|
212
|
+
end
|
213
|
+
|
214
|
+
def self.add_attachments(mail, attachments)
|
215
|
+
attachments.each do |name, body|
|
216
|
+
name = name.gsub /\s+/, ' '
|
217
|
+
|
218
|
+
# mime-types wants to send these as "quoted-printable"
|
219
|
+
if name =~ /\.xlsx$/
|
220
|
+
mail.attachments[name] = {
|
221
|
+
:content => Base64.encode64(body),
|
222
|
+
:transfer_encoding => :base64
|
223
|
+
}
|
224
|
+
else
|
225
|
+
mail.attachments[name] = body
|
226
|
+
end
|
227
|
+
mail.attachments[name].add_content_id("<#{name}@#{Socket.gethostname}>")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def self.sendmail_binary
|
232
|
+
sendmail = `which sendmail`.chomp
|
233
|
+
sendmail.empty? ? '/usr/sbin/sendmail' : sendmail
|
234
|
+
end
|
235
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: SimpleMail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- saroar
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mail
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: Very Simple gem for send mail
|
70
|
+
email:
|
71
|
+
- saroar9@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- SimpleMail.gemspec
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/SimpleMail.rb
|
88
|
+
- lib/SimpleMail/version.rb
|
89
|
+
homepage: https://github.com/saroar/SimpleMail.git
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata:
|
93
|
+
allowed_push_host: https://rubygems.org
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.6.13
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Simple gem for sending email notification
|
114
|
+
test_files: []
|
115
|
+
has_rdoc:
|