aws-ses 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.4.2:
2
+ * Added support for ReplyToAddresses, Destinations, and Source (pzb)
3
+ * Added custom User-Agent header (pzb)
4
+ * Widespread doc updates
5
+
1
6
  0.4.1:
2
7
  * Removed many unneeded monkeypatch extensions
3
8
  * Tests ( and gem ) run in 1.9.2
data/README.erb CHANGED
@@ -42,6 +42,24 @@ Then set the delivery method in `config/environments/*rb` as appropriate:
42
42
  ActionMailer::Base.delivery_method = :amazon_ses
43
43
  ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => 'abc', :access_key_id => '123')
44
44
  end
45
+
46
+ == Issues
47
+
48
+ === HTTP Segmentation fault
49
+
50
+ If you get this error:
51
+ net/http.rb:677: [BUG] Segmentation fault
52
+
53
+ It means that you are not running with SSL enabled in ruby. Re-compile ruby with ssl support or add this option to your environment:
54
+ RUBYOPT="-r openssl"
55
+
56
+ === Rejected sending
57
+
58
+ If you are receiving this message and you HAVE verified the [source] please <b>check to be sure you are not in sandbox mode!</b>
59
+ "Email address is not verified.MessageRejected (AWS::Error)"
60
+ If you have not been granted production access, you will have to <b>verify all recipients</b> as well.
61
+
62
+ http://docs.amazonwebservices.com/ses/2010-12-01/DeveloperGuide/index.html?InitialSetup.Customer.html
45
63
 
46
64
  == Source
47
65
 
@@ -69,4 +87,6 @@ Special thanks to Marcel Molina Jr. for his creation of AWS::S3 which I used por
69
87
 
70
88
  * croaky
71
89
  * nathanbertram
72
- * sshaw
90
+ * sshaw
91
+ * teeparham (documentation)
92
+ * pzb
@@ -27,10 +27,15 @@ Use the following to send an e-mail:
27
27
 
28
28
  ses = AWS::SES::Base.new( ... connection info ... )
29
29
  ses.send_email :to => ['jon@example.com', 'dave@example.com'],
30
- :source => 'steve@example.com',
30
+ :source => '"Steve Smith" <steve@example.com>',
31
31
  :subject => 'Subject Line'
32
32
  :text_body => 'Internal text body'
33
33
 
34
+ By default, the email "from" display address is whatever is before the @.
35
+ To change the display from, use the format:
36
+
37
+ "Steve Smith" <steve@example.com>
38
+
34
39
  You can also send Mail objects using send_raw_email:
35
40
 
36
41
  m = Mail.new( :to => ..., :from => ... )
@@ -39,6 +44,7 @@ You can also send Mail objects using send_raw_email:
39
44
  send_raw_email will also take a hash and pass it through Mail.new automatically as well.
40
45
 
41
46
 
47
+
42
48
  == Addresses
43
49
 
44
50
  AWS::SES::Addresses provides for:
@@ -71,7 +77,7 @@ You can access these methods as follows:
71
77
  == Get the quota information
72
78
  response = ses.quota
73
79
  # How many e-mails you've sent in the last 24 hours
74
- response.send_last_24_hours
80
+ response.sent_last_24_hours
75
81
  # How many e-mails you're allowed to send in 24 hours
76
82
  response.max_24_hour_send
77
83
  # How many e-mails you can send per second
@@ -140,6 +146,24 @@ Then set the delivery method in `config/environments/*rb` as appropriate:
140
146
  ActionMailer::Base.delivery_method = :amazon_ses
141
147
  ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => 'abc', :access_key_id => '123')
142
148
  end
149
+
150
+ == Issues
151
+
152
+ === HTTP Segmentation fault
153
+
154
+ If you get this error:
155
+ net/http.rb:677: [BUG] Segmentation fault
156
+
157
+ It means that you are not running with SSL enabled in ruby. Re-compile ruby with ssl support or add this option to your environment:
158
+ RUBYOPT="-r openssl"
159
+
160
+ === Rejected sending
161
+
162
+ If you are receiving this message and you HAVE verified the [source] please <b>check to be sure you are not in sandbox mode!</b>
163
+ "Email address is not verified.MessageRejected (AWS::Error)"
164
+ If you have not been granted production access, you will have to <b>verify all recipients</b> as well.
165
+
166
+ http://docs.amazonwebservices.com/ses/2010-12-01/DeveloperGuide/index.html?InitialSetup.Customer.html
143
167
 
144
168
  == Source
145
169
 
@@ -167,4 +191,6 @@ Special thanks to Marcel Molina Jr. for his creation of AWS::S3 which I used por
167
191
 
168
192
  * croaky
169
193
  * nathanbertram
170
- * sshaw
194
+ * sshaw
195
+ * teeparham (documentation)
196
+ * pzb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aws-ses}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Drew Blas", "Marcel Molina Jr."]
12
- s.date = %q{2011-02-09}
12
+ s.date = %q{2011-03-11}
13
13
  s.description = %q{Client library for Amazon's Simple Email Service's REST API}
14
14
  s.email = %q{drew.blas@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -52,7 +52,7 @@ Gem::Specification.new do |s|
52
52
  s.homepage = %q{http://github.com/drewblas/aws-ses}
53
53
  s.licenses = ["MIT"]
54
54
  s.require_paths = ["lib"]
55
- s.rubygems_version = %q{1.4.2}
55
+ s.rubygems_version = %q{1.5.2}
56
56
  s.summary = %q{Client library for Amazon's Simple Email Service's REST API}
57
57
  s.test_files = [
58
58
  "test/address_test.rb",
@@ -23,6 +23,8 @@ module AWS #:nodoc:
23
23
 
24
24
  DEFAULT_HOST = 'email.us-east-1.amazonaws.com'
25
25
 
26
+ USER_AGENT = 'github-aws-ses-ruby-gem'
27
+
26
28
  # Encodes the given string with the secret_access_key by taking the
27
29
  # hmac-sha1 sum, and then base64 encoding it. Optionally, it will also
28
30
  # url encode the result of that to protect the string if it's going to
@@ -66,6 +68,7 @@ module AWS #:nodoc:
66
68
  # @option options [Boolean] :use_ssl (true) Connect using SSL?
67
69
  # @option options [String] :server ("email.us-east-1.amazonaws.com") The server API endpoint host
68
70
  # @option options [String] :proxy_server (nil) An HTTP proxy server FQDN
71
+ # @option options [String] :user_agent ("github-aws-ses-ruby-gem") The HTTP User-Agent header value
69
72
  # @return [Object] the object.
70
73
  def initialize( options = {} )
71
74
 
@@ -74,6 +77,7 @@ module AWS #:nodoc:
74
77
  :use_ssl => true,
75
78
  :server => DEFAULT_HOST,
76
79
  :path => "/",
80
+ :user_agent => USER_AGENT,
77
81
  :proxy_server => nil
78
82
  }.merge(options)
79
83
 
@@ -81,6 +85,7 @@ module AWS #:nodoc:
81
85
  @proxy_server = options[:proxy_server]
82
86
  @use_ssl = options[:use_ssl]
83
87
  @path = options[:path]
88
+ @user_agent = options[:user_agent]
84
89
 
85
90
  raise ArgumentError, "No :access_key_id provided" if options[:access_key_id].nil? || options[:access_key_id].empty?
86
91
  raise ArgumentError, "No :secret_access_key provided" if options[:secret_access_key].nil? || options[:secret_access_key].empty?
@@ -147,7 +152,7 @@ module AWS #:nodoc:
147
152
 
148
153
  req['X-Amzn-Authorization'] = get_aws_auth_param(timestamp.httpdate, @secret_access_key)
149
154
  req['Date'] = timestamp.httpdate
150
- req['User-Agent'] = "github-aws-ses-ruby-gem"
155
+ req['User-Agent'] = @user_agent
151
156
 
152
157
  response = connection.post(@path, query, req)
153
158
 
@@ -9,7 +9,7 @@ module AWS
9
9
  # == Get the quota information
10
10
  # response = ses.quota
11
11
  # # How many e-mails you've sent in the last 24 hours
12
- # response.send_last_24_hours
12
+ # response.sent_last_24_hours
13
13
  # # How many e-mails you're allowed to send in 24 hours
14
14
  # response.max_24_hour_send
15
15
  # # How many e-mails you can send per second
@@ -5,16 +5,22 @@ module AWS
5
5
  #
6
6
  # ses = AWS::SES::Base.new( ... connection info ... )
7
7
  # ses.send_email :to => ['jon@example.com', 'dave@example.com'],
8
- # :source => 'steve@example.com',
8
+ # :source => '"Steve Smith" <steve@example.com>',
9
9
  # :subject => 'Subject Line'
10
10
  # :text_body => 'Internal text body'
11
11
  #
12
+ # By default, the email "from" display address is whatever is before the @.
13
+ # To change the display from, use the format:
14
+ #
15
+ # "Steve Smith" <steve@example.com>
16
+ #
12
17
  # You can also send Mail objects using send_raw_email:
13
18
  #
14
19
  # m = Mail.new( :to => ..., :from => ... )
15
20
  # ses.send_raw_email(m)
16
21
  #
17
22
  # send_raw_email will also take a hash and pass it through Mail.new automatically as well.
23
+ #
18
24
  module SendEmail
19
25
 
20
26
  # Sends an email through SES
@@ -27,7 +33,7 @@ module AWS
27
33
  # ---
28
34
  # = "Email address is not verified.MessageRejected (AWS::Error)"
29
35
  # If you are receiving this message and you HAVE verified the [source] please <b>check to be sure you are not in sandbox mode!</b>
30
- # If you have not been granted production access, you will have to <b>verify all recipients</b as well.
36
+ # If you have not been granted production access, you will have to <b>verify all recipients</b> as well.
31
37
  # http://docs.amazonwebservices.com/ses/2010-12-01/DeveloperGuide/index.html?InitialSetup.Customer.html
32
38
  # ---
33
39
  #
@@ -40,6 +46,7 @@ module AWS
40
46
  # @option options [String] :html_body
41
47
  # @option options [String] :text_body
42
48
  # @option options [String] :return_path The email address to which bounce notifications are to be forwarded. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient's ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter.
49
+ # @option options [String] :reply_to The reploy-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.
43
50
  # @option options
44
51
  # @return [Response] the response to sending this e-mail
45
52
  def send_email(options = {})
@@ -58,6 +65,8 @@ module AWS
58
65
 
59
66
  package['ReturnPath'] = options[:return_path] if options[:return_path]
60
67
 
68
+ add_array_to_hash!(package, 'ReplyToAddresses', options[:reply_to]) if options[:reply_to]
69
+
61
70
  request('SendEmail', package)
62
71
  end
63
72
 
@@ -81,10 +90,21 @@ module AWS
81
90
  # @option mail [String] A raw string that is a properly formatted e-mail message
82
91
  # @option mail [Hash] A hash that will be parsed by Mail.new
83
92
  # @option mail [Mail] A mail object, ready to be encoded
93
+ # @option args [String] :source The sender's email address
94
+ # @option args [String] :destinations A list of destinations for the message.
95
+ # @option args [String] :from alias for :source
96
+ # @option args [String] :to alias for :destinations
84
97
  # @return [Response]
85
- def send_raw_email(mail)
98
+ def send_raw_email(mail, args = {})
86
99
  message = mail.is_a?(Hash) ? Mail.new(mail).to_s : mail.to_s
87
100
  package = { 'RawMessage.Data' => Base64::encode64(message) }
101
+ package['Source'] = args[:from] if args[:from]
102
+ package['Source'] = args[:source] if args[:source]
103
+ if args[:destinations]
104
+ add_array_to_hash!(package, 'Destinations', args[:destinations])
105
+ else
106
+ add_array_to_hash!(package, 'Destinations', args[:to]) if args[:to]
107
+ end
88
108
  request('SendRawEmail', package)
89
109
  end
90
110
 
@@ -121,4 +141,4 @@ module AWS
121
141
 
122
142
  end
123
143
  end
124
- end
144
+ end
@@ -3,7 +3,7 @@ module AWS
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = '0'
5
5
  MINOR = '4'
6
- TINY = '1'
6
+ TINY = '2'
7
7
  BETA = Time.now.to_i.to_s
8
8
  end
9
9
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-ses
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Drew Blas
@@ -16,14 +16,12 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-09 00:00:00 -06:00
19
+ date: 2011-03-11 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- prerelease: false
24
- name: xml-simple
25
23
  type: :runtime
26
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
27
25
  none: false
28
26
  requirements:
29
27
  - - ">="
@@ -32,12 +30,12 @@ dependencies:
32
30
  segments:
33
31
  - 0
34
32
  version: "0"
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
33
+ name: xml-simple
34
+ version_requirements: *id001
37
35
  prerelease: false
38
- name: builder
36
+ - !ruby/object:Gem::Dependency
39
37
  type: :runtime
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
40
  requirements:
43
41
  - - ">="
@@ -46,12 +44,12 @@ dependencies:
46
44
  segments:
47
45
  - 0
48
46
  version: "0"
49
- requirement: *id002
50
- - !ruby/object:Gem::Dependency
47
+ name: builder
48
+ version_requirements: *id002
51
49
  prerelease: false
52
- name: mime-types
50
+ - !ruby/object:Gem::Dependency
53
51
  type: :runtime
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ requirement: &id003 !ruby/object:Gem::Requirement
55
53
  none: false
56
54
  requirements:
57
55
  - - ">="
@@ -60,12 +58,12 @@ dependencies:
60
58
  segments:
61
59
  - 0
62
60
  version: "0"
63
- requirement: *id003
64
- - !ruby/object:Gem::Dependency
61
+ name: mime-types
62
+ version_requirements: *id003
65
63
  prerelease: false
66
- name: mail
64
+ - !ruby/object:Gem::Dependency
67
65
  type: :runtime
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
66
+ requirement: &id004 !ruby/object:Gem::Requirement
69
67
  none: false
70
68
  requirements:
71
69
  - - ~>
@@ -76,12 +74,12 @@ dependencies:
76
74
  - 2
77
75
  - 5
78
76
  version: 2.2.5
79
- requirement: *id004
80
- - !ruby/object:Gem::Dependency
77
+ name: mail
78
+ version_requirements: *id004
81
79
  prerelease: false
82
- name: shoulda-context
80
+ - !ruby/object:Gem::Dependency
83
81
  type: :development
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
82
+ requirement: &id005 !ruby/object:Gem::Requirement
85
83
  none: false
86
84
  requirements:
87
85
  - - ">="
@@ -90,12 +88,12 @@ dependencies:
90
88
  segments:
91
89
  - 0
92
90
  version: "0"
93
- requirement: *id005
94
- - !ruby/object:Gem::Dependency
91
+ name: shoulda-context
92
+ version_requirements: *id005
95
93
  prerelease: false
96
- name: bundler
94
+ - !ruby/object:Gem::Dependency
97
95
  type: :development
98
- version_requirements: &id006 !ruby/object:Gem::Requirement
96
+ requirement: &id006 !ruby/object:Gem::Requirement
99
97
  none: false
100
98
  requirements:
101
99
  - - ~>
@@ -106,12 +104,12 @@ dependencies:
106
104
  - 0
107
105
  - 0
108
106
  version: 1.0.0
109
- requirement: *id006
110
- - !ruby/object:Gem::Dependency
107
+ name: bundler
108
+ version_requirements: *id006
111
109
  prerelease: false
112
- name: jeweler
110
+ - !ruby/object:Gem::Dependency
113
111
  type: :development
114
- version_requirements: &id007 !ruby/object:Gem::Requirement
112
+ requirement: &id007 !ruby/object:Gem::Requirement
115
113
  none: false
116
114
  requirements:
117
115
  - - ~>
@@ -122,12 +120,12 @@ dependencies:
122
120
  - 5
123
121
  - 2
124
122
  version: 1.5.2
125
- requirement: *id007
126
- - !ruby/object:Gem::Dependency
123
+ name: jeweler
124
+ version_requirements: *id007
127
125
  prerelease: false
128
- name: rcov
126
+ - !ruby/object:Gem::Dependency
129
127
  type: :development
130
- version_requirements: &id008 !ruby/object:Gem::Requirement
128
+ requirement: &id008 !ruby/object:Gem::Requirement
131
129
  none: false
132
130
  requirements:
133
131
  - - ">="
@@ -136,12 +134,12 @@ dependencies:
136
134
  segments:
137
135
  - 0
138
136
  version: "0"
139
- requirement: *id008
140
- - !ruby/object:Gem::Dependency
137
+ name: rcov
138
+ version_requirements: *id008
141
139
  prerelease: false
142
- name: flexmock
140
+ - !ruby/object:Gem::Dependency
143
141
  type: :development
144
- version_requirements: &id009 !ruby/object:Gem::Requirement
142
+ requirement: &id009 !ruby/object:Gem::Requirement
145
143
  none: false
146
144
  requirements:
147
145
  - - ~>
@@ -152,12 +150,12 @@ dependencies:
152
150
  - 8
153
151
  - 11
154
152
  version: 0.8.11
155
- requirement: *id009
156
- - !ruby/object:Gem::Dependency
153
+ name: flexmock
154
+ version_requirements: *id009
157
155
  prerelease: false
158
- name: xml-simple
156
+ - !ruby/object:Gem::Dependency
159
157
  type: :runtime
160
- version_requirements: &id010 !ruby/object:Gem::Requirement
158
+ requirement: &id010 !ruby/object:Gem::Requirement
161
159
  none: false
162
160
  requirements:
163
161
  - - ">="
@@ -166,12 +164,12 @@ dependencies:
166
164
  segments:
167
165
  - 0
168
166
  version: "0"
169
- requirement: *id010
170
- - !ruby/object:Gem::Dependency
167
+ name: xml-simple
168
+ version_requirements: *id010
171
169
  prerelease: false
172
- name: builder
170
+ - !ruby/object:Gem::Dependency
173
171
  type: :runtime
174
- version_requirements: &id011 !ruby/object:Gem::Requirement
172
+ requirement: &id011 !ruby/object:Gem::Requirement
175
173
  none: false
176
174
  requirements:
177
175
  - - ">="
@@ -180,12 +178,12 @@ dependencies:
180
178
  segments:
181
179
  - 0
182
180
  version: "0"
183
- requirement: *id011
184
- - !ruby/object:Gem::Dependency
181
+ name: builder
182
+ version_requirements: *id011
185
183
  prerelease: false
186
- name: mime-types
184
+ - !ruby/object:Gem::Dependency
187
185
  type: :runtime
188
- version_requirements: &id012 !ruby/object:Gem::Requirement
186
+ requirement: &id012 !ruby/object:Gem::Requirement
189
187
  none: false
190
188
  requirements:
191
189
  - - ">="
@@ -194,7 +192,9 @@ dependencies:
194
192
  segments:
195
193
  - 0
196
194
  version: "0"
197
- requirement: *id012
195
+ name: mime-types
196
+ version_requirements: *id012
197
+ prerelease: false
198
198
  description: Client library for Amazon's Simple Email Service's REST API
199
199
  email: drew.blas@gmail.com
200
200
  executables: []
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  requirements: []
267
267
 
268
268
  rubyforge_project:
269
- rubygems_version: 1.4.2
269
+ rubygems_version: 1.5.2
270
270
  signing_key:
271
271
  specification_version: 3
272
272
  summary: Client library for Amazon's Simple Email Service's REST API