Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ANN] Mail 1.5.0

0 views
Skip to first unread message

Mikel Lindsaar

unread,
Jan 2, 2010, 8:00:00 PM1/2/10
to
[Note: parts of this message were removed to make it a legal post.]

Mail has been screaming along in development over the past month.

I have replaced out TMail from ActionMailer with the Mail gem and this is
now committed as part of Rails / ActionMailer 3.0. So look out for a lot
more Mail action in the new year.

Mail 1.5.0 has some API changes from Mail 1.4.x. The biggest that will
break your use with mail is that Message#field_name now returns a default
value, instead of an object. You can still access the field object by
calling Message#[:field_name] or Message#header.field_name

This allows us to do the following:

require 'mail'
=> true
mail = Mail.new
=> #<Mail::Message:0x1021393d8...
mail.from = 'Mikel <mi...@test.lindsaar.net>'
=> "Mikel <mi...@test.lindsaar.net>"
mail.from
=> "mi...@test.lindsaar.net"
mail.from.class
=> String
mail.from 'Mikel <mi...@test.lindsaar.net>, a...@test.lindsaar.net'
=> "Mikel <mi...@test.lindsaar.net>, a...@test.lindsaar.net"
mail.from
=> ["mi...@test.lindsaar.net", "a...@test.lindsaar.net"]
mail.date = Time.now
=> Sun Jan 03 11:49:00 +1100 2010
mail.date
=> Sun, 03 Jan 2010 11:49:00 +1100
mail.date.class
=> DateTime
mail.content_type 'text/plain; charset=utf-8'
=> "text/plain; charset=utf-8"
mail.content_type
=> "text/plain; charset=utf-8"
mail.mime_type
=> "text/plain"
mail.content_type_parameters
=> {"charset"=>"utf-8"}

You can still access the field objects by going via Message#[:field_name]

mail[:content_type]
=> #<Mail::Field:0x1020d04f0 @field=#<Mail::ContentTypeField:0x1020d0108...

See the change log at:

http://github.com/mikel/mail/blob/master/CHANGELOG.rdoc

Install with:

gem install mail

Instructions are at:

http://github.com/mikel/mail/

--
http://lindsaar.net/
Rails, RSpec and Life blog....

0 new messages