Main Page | Report this Page
Computers Forum Index  »  Computer Languages (Ruby)  »  [ANN] mail...
Page 1 of 1    

[ANN] mail...

Author Message
Mikel Lindsaar...
Posted: Sun Oct 25, 2009 5:17 am
Guest
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 at (no spam) gmail.com'
from 'Mikel Lindsaar <mikel at (no spam) 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 at (no spam) 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:

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


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....
 
Mikel Lindsaar...
Posted: Sun Oct 25, 2009 5:17 am
Guest
On Sun, Oct 25, 2009 at 3:19 PM, James Edward Gray II
<james at (no spam) graysoftinc.com> wrote:
Quote:
On Oct 24, 2009, at 9:38 PM, Mikel Lindsaar wrote:
Wow, I find this library very exciting!  Thanks 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é 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

--
http://lindsaar.net/
Rails, RSpec and Life blog....
 
James Edward Gray II...
Posted: Sun Oct 25, 2009 5:17 am
Guest
On Oct 24, 2009, at 9:38 PM, Mikel Lindsaar wrote:

Quote:
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
 
botp...
Posted: Mon Oct 26, 2009 4:33 am
Guest
On Sun, Oct 25, 2009 at 10:38 AM, Mikel Lindsaar <raasdnil at (no spam) gmail.com> wrote:
Quote:

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.

Quote:
gem install mail

will this be on rubyforge too?

thanks for mail.
kind regards -botp
 
Mikel Lindsaar...
Posted: Mon Oct 26, 2009 5:17 am
Guest
On Mon, Oct 26, 2009 at 11:33 AM, botp <botpena at (no spam) gmail.com> wrote:
Quote:
On Sun, Oct 25, 2009 at 10:38 AM, Mikel Lindsaar <raasdnil at (no spam) 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?

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

Mikel


--
http://lindsaar.net/
Rails, RSpec and Life blog....
 
barjunk...
Posted: Thu Oct 29, 2009 11:12 pm
Guest
On Oct 29, 2:26 am, Mikel Lindsaar <raasd... at (no spam) gmail.com> wrote:
Quote:
On 29/10/2009, at 4:53, Aldric Giacomoni <ald... at (no spam) 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

I say thanks as well. Glad to see it!

Mike B.
 
 
Page 1 of 1    
All times are GMT
The time now is Sun Dec 06, 2009 4:06 pm