mail 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mail might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +6 -0
- data/README.rdoc +19 -13
- data/Rakefile +1 -1
- data/lib/mail/message.rb +17 -9
- data/lib/mail/network/delivery_methods/smtp.rb +2 -2
- data/lib/mail/part.rb +1 -1
- data/lib/mail/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== Thu Jan 28 00:25:02 UTC 2010 Mikel Lindsaar <raasdnil@gmail.com>
|
2
|
+
|
3
|
+
* Added TMM1's patch to not raise errors if a email is not multipart/report
|
4
|
+
* Added html_part and text_part now return the first text/html or text/plain part they find. Order is from top to bottom of the email, all parts, flattened.
|
5
|
+
* Version bump to 2.1.2
|
6
|
+
|
1
7
|
== Mon Jan 25 11:36:13 UTC 2010 Mikel Lindsaar <raasdnil@gmail.com>
|
2
8
|
|
3
9
|
* Added ability for address fields to init on an array instead of just a string.
|
data/README.rdoc
CHANGED
@@ -219,11 +219,9 @@ what you are doing.
|
|
219
219
|
|
220
220
|
=== Sending an email:
|
221
221
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
smtp '127.0.0.1', 25
|
226
|
-
end
|
222
|
+
Mail defaults to sending via SMTP to local host port 25. If you have a
|
223
|
+
sendmail or postfix daemon running on on this port, sending email is as
|
224
|
+
easy as:
|
227
225
|
|
228
226
|
Mail.deliver do
|
229
227
|
from 'me@test.lindsaar.net'
|
@@ -235,10 +233,6 @@ what you are doing.
|
|
235
233
|
|
236
234
|
or
|
237
235
|
|
238
|
-
Mail.defaults do
|
239
|
-
smtp '127.0.0.1' # Port 25 defult
|
240
|
-
end
|
241
|
-
|
242
236
|
mail = Mail.new do
|
243
237
|
from 'me@test.lindsaar.net'
|
244
238
|
to 'you@test.lindsaar.net'
|
@@ -249,6 +243,22 @@ or
|
|
249
243
|
|
250
244
|
mail.deliver!
|
251
245
|
|
246
|
+
Sending via sendmail can be done like so:
|
247
|
+
|
248
|
+
mail = Mail.new do
|
249
|
+
from 'me@test.lindsaar.net'
|
250
|
+
to 'you@test.lindsaar.net'
|
251
|
+
subject 'Here is the image you wanted'
|
252
|
+
body File.read('body.txt')
|
253
|
+
add_file {:filename => 'somefile.png', :content => File.read('/somefile.png')}
|
254
|
+
end
|
255
|
+
|
256
|
+
mail.delivery_method :sendmail
|
257
|
+
|
258
|
+
mail.deliver
|
259
|
+
|
260
|
+
mail.deliver!
|
261
|
+
|
252
262
|
|
253
263
|
=== Getting emails from a pop server:
|
254
264
|
|
@@ -344,10 +354,6 @@ simple as possible.... (asking a lot from a mail library)
|
|
344
354
|
|
345
355
|
require 'mail'
|
346
356
|
|
347
|
-
Mail.defaults do
|
348
|
-
smtp '127.0.0.1' # Port 25 defult
|
349
|
-
end
|
350
|
-
|
351
357
|
mail = Mail.deliver do
|
352
358
|
to 'nicolas@test.lindsaar.net.au'
|
353
359
|
from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
|
data/Rakefile
CHANGED
data/lib/mail/message.rb
CHANGED
@@ -1379,31 +1379,31 @@ module Mail
|
|
1379
1379
|
end
|
1380
1380
|
|
1381
1381
|
def bounced?
|
1382
|
-
delivery_status_part.bounced?
|
1382
|
+
delivery_status_part and delivery_status_part.bounced?
|
1383
1383
|
end
|
1384
1384
|
|
1385
1385
|
def action
|
1386
|
-
delivery_status_part.action
|
1386
|
+
delivery_status_part and delivery_status_part.action
|
1387
1387
|
end
|
1388
1388
|
|
1389
1389
|
def final_recipient
|
1390
|
-
delivery_status_part.final_recipient
|
1390
|
+
delivery_status_part and delivery_status_part.final_recipient
|
1391
1391
|
end
|
1392
1392
|
|
1393
1393
|
def error_status
|
1394
|
-
delivery_status_part.error_status
|
1394
|
+
delivery_status_part and delivery_status_part.error_status
|
1395
1395
|
end
|
1396
1396
|
|
1397
1397
|
def diagnostic_code
|
1398
|
-
delivery_status_part.diagnostic_code
|
1398
|
+
delivery_status_part and delivery_status_part.diagnostic_code
|
1399
1399
|
end
|
1400
1400
|
|
1401
1401
|
def remote_mta
|
1402
|
-
delivery_status_part.remote_mta
|
1402
|
+
delivery_status_part and delivery_status_part.remote_mta
|
1403
1403
|
end
|
1404
1404
|
|
1405
1405
|
def retryable?
|
1406
|
-
delivery_status_part.retryable?
|
1406
|
+
delivery_status_part and delivery_status_part.retryable?
|
1407
1407
|
end
|
1408
1408
|
|
1409
1409
|
# Returns the current boundary for this message part
|
@@ -1465,7 +1465,7 @@ module Mail
|
|
1465
1465
|
add_multipart_alternate_header unless html_part.blank?
|
1466
1466
|
add_part(@html_part)
|
1467
1467
|
else
|
1468
|
-
@html_part
|
1468
|
+
@html_part || find_first_mime_type('text/html')
|
1469
1469
|
end
|
1470
1470
|
end
|
1471
1471
|
|
@@ -1476,7 +1476,7 @@ module Mail
|
|
1476
1476
|
add_multipart_alternate_header unless html_part.blank?
|
1477
1477
|
add_part(@text_part)
|
1478
1478
|
else
|
1479
|
-
@text_part
|
1479
|
+
@text_part || find_first_mime_type('text/plain')
|
1480
1480
|
end
|
1481
1481
|
end
|
1482
1482
|
|
@@ -1649,6 +1649,14 @@ module Mail
|
|
1649
1649
|
def filename
|
1650
1650
|
find_attachment
|
1651
1651
|
end
|
1652
|
+
|
1653
|
+
def all_parts
|
1654
|
+
parts.map { |p| [p, p.all_parts] }.flatten
|
1655
|
+
end
|
1656
|
+
|
1657
|
+
def find_first_mime_type(mt)
|
1658
|
+
all_parts.detect { |p| p.mime_type == mt }
|
1659
|
+
end
|
1652
1660
|
|
1653
1661
|
private
|
1654
1662
|
|
@@ -28,8 +28,8 @@ module Mail
|
|
28
28
|
# delivery_method :smtp, { :address => "smtp.gmail.com",
|
29
29
|
# :port => 587,
|
30
30
|
# :domain => 'baci.lindsaar.net',
|
31
|
-
# :user_name => '
|
32
|
-
# :password => '
|
31
|
+
# :user_name => '<username>',
|
32
|
+
# :password => '<password>',
|
33
33
|
# :authentication => 'plain',
|
34
34
|
# :enable_starttls_auto => true }
|
35
35
|
# end
|
data/lib/mail/part.rb
CHANGED
data/lib/mail/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Lindsaar
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-28 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|