The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
RhizMail 0.1.1

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Francis Hwang

Posts: 130
Nickname: francis
Registered: Jul, 2004

Francis Hwang is the Director of Technology at Rhizome.org.
RhizMail 0.1.1 Posted: Aug 29, 2005 5:05 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Francis Hwang.
Original Post: RhizMail 0.1.1
Feed Title: Francis Hwang's site: ruby
Feed URL: http://fhwang.net/syndicate/ruby.atom
Feed Description: Author & artist Francis Hwang's personal site.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Francis Hwang
Latest Posts From Francis Hwang's site: ruby

Advertisement

I’ve just released the newest version of RhizMail, the email library we use at Rhizome. Most of the changes are minor, but one bigger change is making it easier to parameterize a child of SimpleTemplateMessage.

For example, You can still create a SimpleTemplateMessage directly:

msg = RhizMail::SimpleTemplateMessage.new(
 :to_address => 'john.doe@email.com',
 :from_address => 'webmaster@website.com',
 :template_file => '/Users/francis/Desktop/template.txt'
)
msg.substitute( 'email', 'john.doe@email.com' )
msg.substitute( 'password', 'p4ssw0rd' )
msg.deliver

But you can also create a child, parameterizing it with class methods:

class IntroEmail < RhizMail::SimpleTemplateMessage
 from_address 'webmaster@website.com'
 template '/Users/francis/Desktop/template.txt'
 substitute 'email', Proc.new { |msg| msg.user.email }
 substitute 'password', Proc.new { |msg| msg.user.password }
 attr_reader :user
 def initialize( user )
 @user = user
 super( :to_address => user.email )
 end
end
User = Struct.new( :email, :password )
u = User.new( 'john.doe@email.com', 'p4ssw0rd' )
email = IntroEmail.new u

Read: RhizMail 0.1.1

Topic: New Stuff Previous Topic   Next Topic Topic: Movie night

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use