postmark-rails 0.3.0 → 0.4.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.
- data/CHANGELOG.rdoc +4 -0
- data/Gemfile +1 -1
- data/README.rdoc +51 -6
- data/VERSION +1 -1
- data/lib/postmark-rails.rb +1 -0
- data/lib/postmark_delivery_method.rb +9 -4
- data/postmark-rails.gemspec +2 -2
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -24,8 +24,8 @@ The Postmark Rails Gem is a drop-in plug-in for ActionMailer to send emails via
|
|
24
24
|
|
25
25
|
Add this to your Gemfile: (change version numbers if needed)
|
26
26
|
|
27
|
-
gem 'postmark', '0.
|
28
|
-
gem 'postmark-rails', '0.
|
27
|
+
gem 'postmark', '0.9.0'
|
28
|
+
gem 'postmark-rails', '0.4.0'
|
29
29
|
|
30
30
|
Don't forget to run "bundle install" command every time you change something in the Gemfile.
|
31
31
|
|
@@ -79,14 +79,58 @@ You can use a tag to categorize outgoing messages and attach application-specifi
|
|
79
79
|
class SuperMailer < ActionMailer::Base
|
80
80
|
|
81
81
|
def email
|
82
|
-
from "no-reply@
|
83
|
-
subject "
|
84
|
-
recipients "
|
82
|
+
from "no-reply@example.com"
|
83
|
+
subject "Some marvelous email message"
|
84
|
+
recipients "someone-fancy@example.com"
|
85
85
|
tag "my-another-tag"
|
86
86
|
end
|
87
87
|
|
88
88
|
end
|
89
89
|
|
90
|
+
== Sending attachments
|
91
|
+
|
92
|
+
You can also send file attachments with Postmark. Read more here: http://developer.postmarkapp.com/developer-build.html#attachments
|
93
|
+
|
94
|
+
=== Rails 3
|
95
|
+
|
96
|
+
class TestMailer < ActionMailer::Base
|
97
|
+
|
98
|
+
def message_with_attachment
|
99
|
+
mail(
|
100
|
+
:subject => 'hello',
|
101
|
+
:to => 'sheldon@bigbangtheory.com',
|
102
|
+
:from => 'leonard@bigbangtheory.com',
|
103
|
+
:postmark_attachments => [File.open("/path/to/file")]
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
=== Rails 2
|
110
|
+
|
111
|
+
class SuperMailer < ActionMailer::Base
|
112
|
+
|
113
|
+
def email
|
114
|
+
from "no-reply@example.com"
|
115
|
+
subject "Some marvelous email message"
|
116
|
+
recipients "someone-fancy@example.com"
|
117
|
+
postmark_attachments [File.open("/path/to/file")]
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
You can pass either an array of File objects or a single object. Postmark will detect the file name automatically and send an attachment with the "application/octet-stream" content type. If you want more control on how attachments get formatted, you can pass Hash objects, which contain the custom settings such as file name or content-type. Here is an example:
|
123
|
+
|
124
|
+
#
|
125
|
+
# Don't forget to read your file and base64-encode it,
|
126
|
+
# before assigning it to "Content".
|
127
|
+
#
|
128
|
+
message.postmark_attachments = {
|
129
|
+
"Name" => "fancy-file-name.jpg",
|
130
|
+
"Content" => [ IO.read("path/to/file") ].pack("m"),
|
131
|
+
"ContentType" => "image/jpeg"
|
132
|
+
}
|
133
|
+
|
90
134
|
== Note on Patches/Pull Requests
|
91
135
|
|
92
136
|
* Fork the project.
|
@@ -101,7 +145,8 @@ You can use a tag to categorize outgoing messages and attach application-specifi
|
|
101
145
|
* Ilya Sabanin
|
102
146
|
* Hristo Deshev
|
103
147
|
* Randy Schmidt
|
148
|
+
* Chris Williams
|
104
149
|
|
105
150
|
== Copyright
|
106
151
|
|
107
|
-
Copyright © 2010 Wildbit LLC. See LICENSE for details.
|
152
|
+
Copyright © 2010 Wildbit LLC. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/postmark-rails.rb
CHANGED
@@ -15,7 +15,7 @@ module PostmarkDeliveryMethod
|
|
15
15
|
base.extend(ClassMethods)
|
16
16
|
|
17
17
|
base.class_eval do
|
18
|
-
alias_method_chain :create_mail, :
|
18
|
+
alias_method_chain :create_mail, :postmark_extras
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -26,10 +26,15 @@ module PostmarkDeliveryMethod
|
|
26
26
|
def tag(value)
|
27
27
|
@tag = value
|
28
28
|
end
|
29
|
+
|
30
|
+
def postmark_attachments(value)
|
31
|
+
@attachments = value
|
32
|
+
end
|
29
33
|
|
30
|
-
def
|
31
|
-
returning
|
32
|
-
mail.tag = @tag
|
34
|
+
def create_mail_with_postmark_extras
|
35
|
+
returning create_mail_without_postmark_extras do |mail|
|
36
|
+
mail.tag = @tag if @tag
|
37
|
+
mail.postmark_attachments = @attachments if @attachments
|
33
38
|
end
|
34
39
|
end
|
35
40
|
|
data/postmark-rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{postmark-rails}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Petyo Ivanov", "Ilya Sabanin"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-17}
|
13
13
|
s.description = %q{Use this plugin in your rails applications to send emails through the Postmark API}
|
14
14
|
s.email = %q{ilya@wildbit.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 4
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Petyo Ivanov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-17 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|