em-smtp 0.0.1

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,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in em-smtp.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 TODO: Write your name
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.
@@ -0,0 +1,53 @@
1
+ # Em::Smtp
2
+
3
+ EM-SMTP is a very simple asynchronous delivery implementation for ActionMailer
4
+ that wraps EventMachine's SMTP Client.
5
+
6
+ It's extreme lightweight, and suitable for sites that don't need heavy mail
7
+ delivery and don't want to run another separate process.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'em-smtp'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install em-smtp
22
+
23
+ ## Configuration
24
+
25
+ You must let ActionMailer know that you wish to use em-smtp as your
26
+ delivery method. Either in your application's config/application.rb
27
+ file (Rails 3 or latter), or in an environment-specific config file
28
+ such as config/environments/production.rb:
29
+
30
+ config.action_mailer.delivery_method = :em_smtp
31
+
32
+ After that, you may need to change your smtp settings.
33
+ In config/initializers/em_smtp.rb
34
+
35
+ ActionMailer::Base.em_smtp_settings = {
36
+ host: "#{YOUR_SMTP_SERVER}",
37
+ port: 25, # change this if needed
38
+ domain: "#{YOUR_SMTP_DOMAIN}",
39
+ starttls: true # change to false if your smtp server didn't support SSL/TLS
40
+ #auth: { # don't include this if no auth needed
41
+ # type: :plain,
42
+ # username: "#{YOUR_USERNAME}",
43
+ # password: "#{YOUR_PASSWORD}"
44
+ # }
45
+ }
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'em/smtp/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "em-smtp"
8
+ spec.version = Em::Smtp::VERSION
9
+ spec.authors = ["DannyAAM"]
10
+ spec.email = ["danny8376+gems@gmail.com"]
11
+ spec.description = %q{An easy smtp eventmachine wrapper for activemailer.}
12
+ spec.summary = %q{An easy smtp eventmachine wrapper for activemailer.}
13
+ spec.homepage = "https://github.com/danny8376/em-smtp"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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 "eventmachine"
22
+ spec.add_dependency "mail"
23
+ spec.add_dependency "actionmailer"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ end
@@ -0,0 +1 @@
1
+ require "em/smtp"
@@ -0,0 +1,5 @@
1
+ require "action_mailer"
2
+ require "em/smtp/client"
3
+ require "em/smtp/version"
4
+
5
+ ActionMailer::Base.add_delivery_method :em_smtp, Em::Smtp::Client
@@ -0,0 +1,36 @@
1
+ require 'eventmachine'
2
+
3
+ module Em
4
+ module Smtp
5
+ class Client
6
+ def initialize(values)
7
+ self.settings = {
8
+ host: 'localhost',
9
+ port: 25, # optional, defaults 25
10
+ starttls: true, # use ssl
11
+ domain: 'localhost.localdomain',
12
+ #auth: {
13
+ # type: nil, # :plain
14
+ # username: nil, # 'username'
15
+ # password: nil # 'password'
16
+ # }
17
+ }.merge!(values)
18
+ end
19
+
20
+ attr_accessor :settings
21
+
22
+ def deliver!(mail)
23
+ email = EM::Protocols::SmtpClient.send(settings.merge!({
24
+ to: mail[:to].formatted,
25
+ from: mail[:from].addresses[0],
26
+ content: "#{mail.encoded}\r\n.\r\n"
27
+ }))
28
+ # Ignore callbacks now XD
29
+ #email.callback{
30
+ #}
31
+ #email.errback{ |e|
32
+ #}
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Em
2
+ module Smtp
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: em-smtp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - DannyAAM
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-03-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: eventmachine
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: mail
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: actionmailer
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.3'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: An easy smtp eventmachine wrapper for activemailer.
95
+ email:
96
+ - danny8376+gems@gmail.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - .gitignore
102
+ - Gemfile
103
+ - LICENSE.txt
104
+ - README.md
105
+ - Rakefile
106
+ - em-smtp.gemspec
107
+ - lib/em-smtp.rb
108
+ - lib/em/smtp.rb
109
+ - lib/em/smtp/client.rb
110
+ - lib/em/smtp/version.rb
111
+ homepage: https://github.com/danny8376/em-smtp
112
+ licenses:
113
+ - MIT
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 1.8.29
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: An easy smtp eventmachine wrapper for activemailer.
136
+ test_files: []