[ANN] mail

Some of you might know about a little gem that Minero Aoki wrote called tmail.

I took over maintenance of tmail in 2007 to scratch an itch... but I
found it difficult to add new features to.

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. Make the simple, REALLY simple,
and make the complex possible. Taking a page from libmime library, I
decided to BDD a mail library... totally from the ground up. You can
find an entire references library in the source code and every spec
was written to handle a part of some RFC.

Also... I built it from the ground up to work with 1.8.6, 1.8.7 and
1.9.1. Mail passes all 747 examples in all three ruby's.

So, in mail, right now in version 1.0.0 you can do this:

require 'mail'

Mail.defaults do
  smtp '127.0.0.1' # Port 25 defult
end

mail = Mail.deliver do
  to 'raasdnil@gmail.com'
  from 'Mikel Lindsaar <mikel@scientology.net.au>'
  subject 'Multpart HTML Email Test'
  text_part do
    body %Q[Plain text body]
  end
  html_part do
    content_type 'text/html; charset=UTF-8'
    body %Q[<p>Crazy cool HTML Body.</p>
    ]
  end
end

And you just _sent_ a multipart HTML email.

You can also do this:

require 'mail'

mail = Mail.read('/path/to/bounce_message.eml')

mail.bounced? #=> true
mail.final_recipient #=> rfc822;mikel@dont.exist.com
mail.action #=> failed
mail.error_status #=> 5.5.0
mail.diagnostic_code #=> smtp;550 Requested action not taken:
mailbox unavailable
mail.retryable? #=> false

Anyway... as long as you have gemcutter installed and have tumble'd to
it, installing is:

gem install mail

If not:

gem sources -a http://gemcutter.org
gem install mail

Check out some more mail syntactic sugar at:

Note, this is a first release... I need lots of people to play, fork
and fix what they find.

···

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

Wow, I find this library very exciting! Thanks for sharing.

James Edward Gray II

···

On Oct 24, 2009, at 9:38 PM, Mikel Lindsaar wrote:

Some of you might know about a little gem that Minero Aoki wrote called tmail.

I took over maintenance of tmail in 2007 to scratch an itch... but I
found it difficult to add new features to.

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. Make the simple, REALLY simple,
and make the complex possible. Taking a page from libmime library, I
decided to BDD a mail library... totally from the ground up. You can
find an entire references library in the source code and every spec
was written to handle a part of some RFC.

Also... I built it from the ground up to work with 1.8.6, 1.8.7 and
1.9.1. Mail passes all 747 examples in all three ruby's.

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. Make the simple, REALLY simple,
and make the complex possible. Taking a page from libmime library, I

......

indeed. amazingly rubyishly simple.

gem install mail

will this be on rubyforge too?

thanks for mail.
kind regards -botp

···

On Sun, Oct 25, 2009 at 10:38 AM, Mikel Lindsaar <raasdnil@gmail.com> wrote:

Mikel Lindsaar wrote:

Some of you might know about a little gem that Minero Aoki wrote called
tmail.

I took over maintenance of tmail in 2007 to scratch an itch... but I
found it difficult to add new features to.

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. Make the simple, REALLY simple,
and make the complex possible. Taking a page from libmime library, I
decided to BDD a mail library... totally from the ground up. You can
find an entire references library in the source code and every spec
was written to handle a part of some RFC.

Neat. Does it work with M$ Exchange ? (I know, I know - you said it was
RFC /compliant/ ...)

···

--
Posted via http://www.ruby-forum.com/\.

Nice work. Thanks Mikel.

-greg

···

On Sat, Oct 24, 2009 at 10:38 PM, Mikel Lindsaar <raasdnil@gmail.com> wrote:

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. Make the simple, REALLY simple,
and make the complex possible. Taking a page from libmime library, I
decided to BDD a mail library... totally from the ground up. You can
find an entire references library in the source code and every spec
was written to handle a part of some RFC.

Also... I built it from the ground up to work with 1.8.6, 1.8.7 and
1.9.1. Mail passes all 747 examples in all three ruby's.

Mikel Lindsaar wrote:

Some of you might know about a little gem that Minero Aoki wrote called
tmail.

I took over maintenance of tmail in 2007 to scratch an itch... but I
found it difficult to add new features to.

So then I decided to write a mail library [...]

Isn't Tmail used by ActiveMailer ? If so, does that mean your 'mail' may
become part of Rails ?

···

--
Posted via http://www.ruby-forum.com/\.

No problem.

The biggest area the library needs help is multibyte support.

In mail, _everything_ is an object, and I have tried to keep class
responsibility well defined.

There is some code smell in there, especially the multibyte support,
so everyone, expect some changes between 1.0.0 and 1.1 on how things
get handled, there is more refactoring to do, but there are a lot of
specs to ensure code coverage.

Also, mail currently parses every email in the TMail test suite
without crashing, so that says something for reliability.

One more thing, in the announcement, I failed to mention the
contribution of Nicolas Fouché who put together the SMTP and POP3
wrappers.

Anyway, patches and code more than welcome..... there are a lot of
edge cases in email.

Mikel

···

On Sun, Oct 25, 2009 at 3:19 PM, James Edward Gray II <james@graysoftinc.com> wrote:

On Oct 24, 2009, at 9:38 PM, Mikel Lindsaar wrote:
Wow, I find this library very exciting! Thanks for sharing.

--

Rails, RSpec and Life blog....

James Edward Gray II wrote:

Some of you might know about a little gem that Minero Aoki wrote called tmail.

I took over maintenance of tmail in 2007 to scratch an itch... but I
found it difficult to add new features to.

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. Make the simple, REALLY simple,
and make the complex possible. Taking a page from libmime library, I
decided to BDD a mail library... totally from the ground up. You can
find an entire references library in the source code and every spec
was written to handle a part of some RFC.

Also... I built it from the ground up to work with 1.8.6, 1.8.7 and
1.9.1. Mail passes all 747 examples in all three ruby's.

Wow, I find this library very exciting! Thanks for sharing.

I will have to 2nd the motion, thanks for the mail gems Mikel

···

On Oct 24, 2009, at 9:38 PM, Mikel Lindsaar wrote:

James Edward Gray II

--
Kind Regards,
Rajinder Yadav

http://DevMentor.org

Do Good! - Share Freely, Enrich and Empower people to Transform their lives.

Unfortunately I can't register "mail" as a rubyforge gem. That's why
it is on gemcutter

Mikel

···

On Mon, Oct 26, 2009 at 11:33 AM, botp <botpena@gmail.com> wrote:

On Sun, Oct 25, 2009 at 10:38 AM, Mikel Lindsaar <raasdnil@gmail.com> wrote:

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. Make the simple, REALLY simple,
and make the complex possible. Taking a page from libmime library, I

indeed. amazingly rubyishly simple.

gem install mail

will this be on rubyforge too?

--

Rails, RSpec and Life blog....

Thanks for this work, I will check it out v soon, I am using net::smtp at the moment! Can't wait for things to be easier!

Heh, try it and let mr know..... I mean it *should* :slight_smile:

Mikel

···

On 28/10/2009, at 2:11, Aldric Giacomoni <aldric@trevoke.net> wrote:

Neat. Does it work with M$ Exchange ? (I know, I know - you said it was
RFC /compliant/ ...)

It might well, mail works on ruby 1.9 and I know rails 3 is shooting for 1.9 compat.

But mail is a different beast to tmail, having said that one person has already expressed interest to rewrite actionmailer to use mail, it would actually simplify a lot of the actionmailer code, but this is just talk at the moment.

Mikel

···

On 29/10/2009, at 4:53, Aldric Giacomoni <aldric@trevoke.net> wrote:

So then I decided to write a mail library [...]

Isn't Tmail used by ActiveMailer ? If so, does that mean your 'mail' may
become part of Rails ?

Great news!

Thanks for your work, I'll surelly check it out.

Mikel Lindsaar wrote:

···

On 28/10/2009, at 2:11, Aldric Giacomoni <aldric@trevoke.net> wrote:

Neat. Does it work with M$ Exchange ? (I know, I know - you said it
was
RFC /compliant/ ...)

Heh, try it and let mr know..... I mean it *should* :slight_smile:

Mikel

It works with Exchange :wink:
Have a (+1) * 1,000.
--
Posted via http://www.ruby-forum.com/\.

I say thanks as well. Glad to see it!

Mike B.

···

On Oct 29, 2:26 am, Mikel Lindsaar <raasd...@gmail.com> wrote:

On 29/10/2009, at 4:53, Aldric Giacomoni <ald...@trevoke.net> wrote:

>> So then I decided to write a mail library [...]

> Isn't Tmail used by ActiveMailer ? If so, does that mean your 'mail'
> may
> become part of Rails ?

It might well, mail works on ruby 1.9 and I know rails 3 is shooting
for 1.9 compat.

But mail is a different beast to tmail, having said that one person
has already expressed interest to rewrite actionmailer to use mail, it
would actually simplify a lot of the actionmailer code, but this is
just talk at the moment.

Mikel