postmark 0.4.0 → 0.4.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.
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/lib/postmark.rb +6 -1
- data/postmark.gemspec +2 -2
- data/spec/postmark_spec.rb +2 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -31,6 +31,8 @@ Then
|
|
31
31
|
message.body = "Hello my friend!"
|
32
32
|
# set custom headers at will.
|
33
33
|
message["CUSTOM-HEADER"] = "my custom header value"
|
34
|
+
# set reply to if you need; also, you can pass array of emails.
|
35
|
+
message.reply_to = "penny@bigbangtheory.com"
|
34
36
|
|
35
37
|
p Postmark.send_through_postmark(message).body
|
36
38
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/postmark.rb
CHANGED
@@ -112,6 +112,11 @@ module Postmark
|
|
112
112
|
|
113
113
|
def convert_tmail(message)
|
114
114
|
options = { "From" => message['from'].to_s, "To" => message['to'].to_s, "Subject" => message.subject, "Headers" => extract_headers(message) }
|
115
|
+
|
116
|
+
if reply_to = message['reply-to']
|
117
|
+
options["ReplyTo"] = reply_to.to_s
|
118
|
+
end
|
119
|
+
|
115
120
|
html = message.body_html
|
116
121
|
text = message.body_text
|
117
122
|
if message.multipart?
|
@@ -126,7 +131,7 @@ module Postmark
|
|
126
131
|
end
|
127
132
|
|
128
133
|
def extract_headers(message)
|
129
|
-
bogus_headers = %w[from to subject]
|
134
|
+
bogus_headers = %w[from to subject reply-to]
|
130
135
|
headers = []
|
131
136
|
message.each_header do |key, value|
|
132
137
|
next if bogus_headers.include? key.downcase
|
data/postmark.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{postmark}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
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"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-01-04}
|
13
13
|
s.description = %q{Ruby gem for sending emails through http://postmarkapp.com HTTP API. It relieas on TMail::Mail for message construction.}
|
14
14
|
s.email = %q{underlog@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/postmark_spec.rb
CHANGED
@@ -111,11 +111,12 @@ describe "Postmark" do
|
|
111
111
|
mail.subject = "Hello!"
|
112
112
|
mail.body = "Hello Sheldon!"
|
113
113
|
mail['CUSTOM-HEADER'] = "header"
|
114
|
+
mail.reply_to = ['a@a.com', 'b@b.com']
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
117
118
|
it "should encode headers properly" do
|
118
|
-
json = %q[{"Subject":"Hello!", "From":"sheldon@bigbangtheory.com", "To":"lenard@bigbangtheory.com", "TextBody":"Hello Sheldon!", "Headers":[{"Name":"CUSTOM-HEADER", "Value":"header"}]}]
|
119
|
+
json = %q[{"Subject":"Hello!", "From":"sheldon@bigbangtheory.com", "ReplyTo":"a@a.com, b@b.com", "To":"lenard@bigbangtheory.com", "TextBody":"Hello Sheldon!", "Headers":[{"Name":"CUSTOM-HEADER", "Value":"header"}]}]
|
119
120
|
result = Postmark.convert_tmail(message_with_headers)
|
120
121
|
result.should == JSON.parse(json)
|
121
122
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petyo Ivanov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-04 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|