[ANN] mail

M

Mikel Lindsaar

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 '(e-mail address removed)'
from 'Mikel Lindsaar <[email protected]>'
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;[email protected]
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:

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


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

James Edward Gray II

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.

James Edward Gray II
 
M

Mikel Lindsaar

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

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=C3=A9 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

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

botp

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. =A0Make the simple, REALLY simple,
and make the complex possible. =A0Taking 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
 
J

jonty

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!
 
A

Aldric Giacomoni

Mikel said:
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/ ...)
 
G

Gregory Brown

So then I decided to write a mail library with the goal of providing a
simple, Ruby DSL on making emails. =A0Make the simple, REALLY simple,
and make the complex possible. =A0Taking a page from libmime library, I
decided to BDD a mail library... totally from the ground up. =A0You 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. =A0Mail passes all 747 examples in all three ruby's.

Nice work. Thanks Mikel.

-greg
 
A

Aldric Giacomoni

Mikel said:
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 ?
 
M

Mikel Lindsaar

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
 
B

barjunk

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

I say thanks as well. Glad to see it!

Mike B.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top