postmark 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rake_tasks +22 -0
- data/README.rdoc +18 -4
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/postmark.rb +9 -3
- data/lib/postmark/tmail_mail_extension.rb +23 -1
- data/postmark.gemspec +4 -3
- metadata +4 -3
data/.rake_tasks
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
build
|
2
|
+
check_dependencies
|
3
|
+
check_dependencies:development
|
4
|
+
check_dependencies:runtime
|
5
|
+
clobber_rcov
|
6
|
+
clobber_rdoc
|
7
|
+
features
|
8
|
+
gemcutter:release
|
9
|
+
gemspec
|
10
|
+
gemspec:generate
|
11
|
+
gemspec:validate
|
12
|
+
install
|
13
|
+
rcov
|
14
|
+
rdoc
|
15
|
+
release
|
16
|
+
rerdoc
|
17
|
+
spec
|
18
|
+
version
|
19
|
+
version:bump:major
|
20
|
+
version:bump:minor
|
21
|
+
version:bump:patch
|
22
|
+
version:write
|
data/README.rdoc
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
Ruby gem for sending emails through http://postmarkapp.com HTTP API
|
4
4
|
|
5
|
+
== Install
|
6
|
+
|
7
|
+
The gem is hosted at gemcutter. If you don't have it, install it first:
|
8
|
+
|
9
|
+
sudo gem install gemcutter
|
10
|
+
gem tumble
|
11
|
+
|
12
|
+
Then
|
13
|
+
sudo gem install postmark
|
14
|
+
|
5
15
|
== Example
|
6
16
|
|
7
17
|
#!/usr/bin/env ruby
|
@@ -23,16 +33,20 @@ Ruby gem for sending emails through http://postmarkapp.com HTTP API
|
|
23
33
|
|
24
34
|
== Requirements
|
25
35
|
|
26
|
-
The gem relies on TMail for building the message. You will also need postmark account, server and sender signature set up to use it.
|
27
|
-
If you plan using it in a rails project, check out the postmark-rails gem, which is meant to integrate with ActionMailer.
|
36
|
+
The gem relies on TMail for building the message. You will also need postmark account, server and sender signature set up to use it.
|
37
|
+
If you plan using it in a rails project, check out the postmark-rails gem, which is meant to integrate with ActionMailer.
|
38
|
+
|
39
|
+
== Limitations
|
40
|
+
Currently postmark API does not support multiple recipients, or attachments. For more information, check the docs here:
|
41
|
+
TODO: URL to docs.
|
28
42
|
|
29
43
|
== Note on Patches/Pull Requests
|
30
|
-
|
44
|
+
|
31
45
|
* Fork the project.
|
32
46
|
* Make your feature addition or bug fix.
|
33
47
|
* Add tests for it. This is important so I don't break it in a
|
34
48
|
future version unintentionally.
|
35
|
-
* Commit, do not mess with rakefile, version, or history.
|
49
|
+
* Commit, do not mess with rakefile, version, or history.
|
36
50
|
* Send me a pull request. Bonus points for topic branches.
|
37
51
|
|
38
52
|
== Copyright
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
gem.summary = %Q{Ruby gem for sending emails through http://postmarkapp.com HTTP API}
|
9
9
|
gem.description = %Q{Ruby gem for sending emails through http://postmarkapp.com HTTP API. It relieas on TMail::Mail for message construction.}
|
10
10
|
gem.email = "underlog@gmail.com"
|
11
|
-
gem.homepage = "http://
|
11
|
+
gem.homepage = "http://postmarkapp.com"
|
12
12
|
gem.authors = ["Petyo Ivanov"]
|
13
13
|
gem.add_development_dependency "rspec"
|
14
14
|
gem.add_development_dependency "cucumber"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/postmark.rb
CHANGED
@@ -29,7 +29,7 @@ module Postmark
|
|
29
29
|
|
30
30
|
# The host to connect to.
|
31
31
|
def host
|
32
|
-
@host ||= 'postmarkapp.com'
|
32
|
+
@host ||= 'api.postmarkapp.com'
|
33
33
|
end
|
34
34
|
|
35
35
|
# The path of the listener
|
@@ -93,10 +93,16 @@ module Postmark
|
|
93
93
|
|
94
94
|
def convert_tmail(message)
|
95
95
|
{ "From" => message['from'].to_s, "To" => message['to'].to_s, "Subject" => message.subject }.tap do |hash|
|
96
|
-
|
96
|
+
# not always true, but should work I guess
|
97
|
+
html = message.body_html
|
98
|
+
text = message.body_text
|
99
|
+
if message.multipart?
|
97
100
|
hash["HtmlBody"] = html
|
101
|
+
hash["TextBody"] = text
|
102
|
+
elsif html
|
103
|
+
hash["HtmlBody"] = message.body_html
|
98
104
|
else
|
99
|
-
hash["TextBody"] =
|
105
|
+
hash["TextBody"] = text
|
100
106
|
end
|
101
107
|
end
|
102
108
|
end
|
@@ -35,6 +35,28 @@ module TMail
|
|
35
35
|
end
|
36
36
|
result
|
37
37
|
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# returs an String with just the plain text part of the body
|
41
|
+
# or nil if there is not any plain text part
|
42
|
+
#
|
43
|
+
def body_text
|
44
|
+
result = unquoted_body
|
45
|
+
if multipart?
|
46
|
+
parts.each do |part|
|
47
|
+
if part.multipart?
|
48
|
+
part.parts.each do |part2|
|
49
|
+
result = part2.unquoted_body if part2.content_type =~ /plain/i
|
50
|
+
end
|
51
|
+
elsif !attachment?(part)
|
52
|
+
result = part.unquoted_body if part.content_type =~ /plain/i
|
53
|
+
end
|
54
|
+
end
|
55
|
+
else
|
56
|
+
result = unquoted_body if content_type =~ /plain/i
|
57
|
+
end
|
58
|
+
result
|
59
|
+
end
|
38
60
|
|
39
61
|
#
|
40
62
|
# This is only for develop.
|
@@ -84,4 +106,4 @@ module TMail
|
|
84
106
|
end
|
85
107
|
|
86
108
|
end
|
87
|
-
end
|
109
|
+
end
|
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.
|
8
|
+
s.version = "0.2.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"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-16}
|
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 = [
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
".rake_tasks",
|
22
23
|
"LICENSE",
|
23
24
|
"README.rdoc",
|
24
25
|
"Rakefile",
|
@@ -34,7 +35,7 @@ Gem::Specification.new do |s|
|
|
34
35
|
"spec/spec.opts",
|
35
36
|
"spec/spec_helper.rb"
|
36
37
|
]
|
37
|
-
s.homepage = %q{http://
|
38
|
+
s.homepage = %q{http://postmarkapp.com}
|
38
39
|
s.rdoc_options = ["--charset=UTF-8"]
|
39
40
|
s.require_paths = ["lib"]
|
40
41
|
s.rubygems_version = %q{1.3.4}
|
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
|
+
version: 0.2.0
|
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: 2009-11-
|
12
|
+
date: 2009-11-16 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -54,6 +54,7 @@ extra_rdoc_files:
|
|
54
54
|
files:
|
55
55
|
- .document
|
56
56
|
- .gitignore
|
57
|
+
- .rake_tasks
|
57
58
|
- LICENSE
|
58
59
|
- README.rdoc
|
59
60
|
- Rakefile
|
@@ -68,7 +69,7 @@ files:
|
|
68
69
|
- spec/spec.opts
|
69
70
|
- spec/spec_helper.rb
|
70
71
|
has_rdoc: true
|
71
|
-
homepage: http://
|
72
|
+
homepage: http://postmarkapp.com
|
72
73
|
licenses: []
|
73
74
|
|
74
75
|
post_install_message:
|