Tip #18 - Take Back Your App Folder!
May 18th, 2008
Contrary to popular (?) belief, your app folder’s content is not restricted to models, controllers, helpers and views. You can through some other stuff in there as well!
Read the rest of this entrySo, in the last two tips, I have shown how to check the format of the email and save the actual address only in the database. But how to check that the email domain name is valid? Easy!
Read the rest of this entryTip #5 - Cleaning Up an Email Address with Ruby on Rails
April 15th, 2008
So you have an email address field on a form in Rails, but how are you going to make sure that all those users enter a sane and well formatted email address? Here is a simple fix to that problem.
Read the rest of this entryTip #4 - Validating an Email Address with Ruby on Rails
April 14th, 2008
Did you know that Rails has inbuilt a strong email handling library called (ahem) TMail? I just so happen to maintain this now (Minero Aoki wrote it), but it gives you a great way to validate email addresses…
Read the rest of this entryHandling Bounced Email with Ruby and TMail
March 25th, 2008
If you are using a Ruby on Rails app, or Nitro, or just a plain Ruby application that handles email, you will need to handle at some point, bounced messages. This a simple way to get to the guts of the email and find out what the error codes are…
Read the rest of this entryTMail 1.2.2 Out with Ruby 1.9 Compatibility
March 10th, 2008
Well, 1.2.2 is now released. You can get the latest version by gem install tmail or download from the TMail Rubyforge project
Read the rest of this entryContributing to TMail
January 20th, 2008
I recently added a new page to the TMail site, contributing!
Read the rest of this entryHow to Upgrade to Rails 2.0
December 13th, 2007
So Rails 2.0 is out! But how do you upgrade? I wrote an article on this a couple of weeks ago on how to update to Rails RC 2. I just reviewed it and it still has basically the correct content, so I just updated it to Rails 2.0. Go have a read if you want, it is called Updating to Rails 2.0 RC
Using TMail Gem in Rails 1.2.6
December 11th, 2007
Ruby on Rails 2.0 includes the ability to load a gem version of TMail instead of the bundled version inside of ActionMailer. However, if you are running on Rails 1.2.6, this doesn’t help you much. Here is how you take advantage of the latest fixes to the TMail library and stay in the 1.2.x branch of Rails
Read the rest of this entrySaving TMail into an ActiveRecord model
November 23rd, 2007
ActiveRecord works well when we are saving strings and integers, but what if you want to save a real, live, honest-to-God Ruby OBJECT like a TMail::Mail instance?? Well.. serialize to the rescue!
Read the rest of this entryTMail::Mail#create_forward now returns mail object
November 22nd, 2007
TMail::Mail instances had an instance method called create_forward hidden away in net.rb. We move it up into the big time with ticket 15445
Read the rest of this entryWhere to start maintaining?
November 18th, 2007
As mentioned previously in the TMail blog, I am now maintaining the code base with another team member. But where to start?
Read the rest of this entryHow to make a reply address with TMail
November 17th, 2007
TMail is quite an extensive mailing library that is suffering from incredibly documentation pains.
The easy stuff is simple, like @mail.to gives you the to address of the email, and @mail.to=”something” sets the to address to something.
But there are some other things that TMail can do to make your life simple and easy and I am going to document them here on this blog.
Recently there was a bug request 15445 on the create_forward function.
I have fixed this bug and closed the ticket and merged the changes back into trunk of TMail.
But what this means now is that you can do the following:
1 2 3 4 5 |
mail = TMail::Mail.load("/path/to/my_email_message") forwarded_email = @mail.create_forward forwarded_email.to = "New address <me@me.com>" text = "Dear me\n\nHere is that email I was talking about!\n" forwarded_email.body = text |
And then you can just send the forwarded_email.
“create_forward” nicely takes the existing email, encodes it into 7-bit ASCII, and the inserts it as an attachment to a new email which it returns to you… Handy :)
“create_forward” is an existing method that has been moved into the main interface.rb file of TMail which means that it will be available to any mail object with a simple require ‘tmail’ in your ruby or rails code.
Hope you enjoy it!
blogLater
Mikel
TMail Is Growing
November 14th, 2007
TMail is the mail library that powers ActionMailer in Ruby on Rails and the mail component of Nitro… and it is alive!
Read the rest of this entry