pakyow-mailer 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/pakyow-mailer/CHANGES +3 -0
- data/pakyow-mailer/MIT-LICENSE +0 -0
- data/pakyow-mailer/README +0 -0
- data/pakyow-mailer/lib/mailer/configuration/base.rb +11 -0
- data/pakyow-mailer/lib/mailer/configuration/mailer.rb +25 -0
- data/pakyow-mailer/lib/mailer/mailer.rb +32 -0
- data/pakyow-mailer/lib/pakyow-mailer.rb +9 -0
- metadata +97 -0
File without changes
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Pakyow
|
2
|
+
module Configuration
|
3
|
+
class Mailer
|
4
|
+
class << self
|
5
|
+
attr_accessor :default_sender, :default_content_type, :delivery_method, :delivery_options
|
6
|
+
|
7
|
+
def default_sender
|
8
|
+
@default_sender || "Pakyow"
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_content_type
|
12
|
+
@default_content_type || 'text/html; charset=UTF-8'
|
13
|
+
end
|
14
|
+
|
15
|
+
def delivery_method
|
16
|
+
@delivery_method || :sendmail
|
17
|
+
end
|
18
|
+
|
19
|
+
def delivery_options
|
20
|
+
@delivery_options || {:enable_starttls_auto => false}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Pakyow
|
2
|
+
class Mailer
|
3
|
+
attr_accessor :view, :message
|
4
|
+
|
5
|
+
def initialize(view_path)
|
6
|
+
@view = Pakyow.app.presenter.view_for_full_view_path(view_path, true)
|
7
|
+
|
8
|
+
@message = Mail.new
|
9
|
+
@message.from = Configuration::Base.mailer.default_sender
|
10
|
+
@message.content_type = Configuration::Base.mailer.default_content_type
|
11
|
+
@message.delivery_method(Configuration::Base.mailer.delivery_method, Configuration::Base.mailer.delivery_options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def deliver_to(recipient, subject = nil)
|
15
|
+
@message.body = self.view.to_html
|
16
|
+
@message.subject = subject if subject
|
17
|
+
|
18
|
+
if recipient.is_a?(Array)
|
19
|
+
recipient.each {|r| deliver(r)}
|
20
|
+
else
|
21
|
+
deliver(recipient)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def deliver(recipient)
|
28
|
+
@message.to = recipient
|
29
|
+
@message.deliver
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pakyow-mailer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bryan Powell
|
9
|
+
- Bret Young
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-11-19 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: pakyow-core
|
17
|
+
requirement: &70127250435900 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - =
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.7.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70127250435900
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: pakyow-presenter
|
28
|
+
requirement: &70127250435420 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - =
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.7.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70127250435420
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: mail
|
39
|
+
requirement: &70127250434860 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '2.3'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70127250434860
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: shoulda
|
50
|
+
requirement: &70127250434320 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '2.11'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70127250434320
|
59
|
+
description: pakyow-mailer
|
60
|
+
email: bryan@metabahn.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- pakyow-mailer/CHANGES
|
66
|
+
- pakyow-mailer/README
|
67
|
+
- pakyow-mailer/MIT-LICENSE
|
68
|
+
- pakyow-mailer/lib/mailer/configuration/base.rb
|
69
|
+
- pakyow-mailer/lib/mailer/configuration/mailer.rb
|
70
|
+
- pakyow-mailer/lib/mailer/mailer.rb
|
71
|
+
- pakyow-mailer/lib/pakyow-mailer.rb
|
72
|
+
homepage: http://pakyow.com
|
73
|
+
licenses: []
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- pakyow-mailer/lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.8.7
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project: pakyow-mailer
|
92
|
+
rubygems_version: 1.8.10
|
93
|
+
signing_key:
|
94
|
+
specification_version: 3
|
95
|
+
summary: pakyow-mailer
|
96
|
+
test_files: []
|
97
|
+
has_rdoc:
|