postmark-rails 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = Changelog
2
2
 
3
+ == 0.4.0
4
+
5
+ * Attachments support.
6
+
3
7
  == 0.3.0
4
8
 
5
9
  * Added support for Rails 3.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gem "actionmailer"
4
- gem "postmark", ">= 0.8.0"
4
+ gem "postmark", ">= 0.9.0"
5
5
  gem "rake"
6
6
 
7
7
  group :test do
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.8.0'
28
- gem 'postmark-rails', '0.3.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@beanseedapp.com"
83
- subject "Testing new gem for Postmark"
84
- recipients "ilya@wildbit.com"
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.3.0
1
+ 0.4.0
@@ -19,6 +19,7 @@ module PostmarkInstaller
19
19
 
20
20
  def install_in_rails_3
21
21
  ActionMailer::Base.add_delivery_method :postmark, Mail::Postmark, :api_key => nil
22
+ Mail::Message.send(:include, Postmark::AttachmentsFixForMail)
22
23
  end
23
24
 
24
25
  end
@@ -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, :tag
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 create_mail_with_tag
31
- returning create_mail_without_tag do |mail|
32
- mail.tag = @tag if @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
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{postmark-rails}
8
- s.version = "0.3.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-16}
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
- - 3
7
+ - 4
8
8
  - 0
9
- version: 0.3.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-16 00:00:00 +02:00
18
+ date: 2010-09-17 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21