If you need to send an e-mail in ruby, this little function works well.
def send_email(from, from_alias, to, to_alias, subject, message)
msg = <<END_OF_MESSAGE
From: #{from_alias} <#{from}>
To: #{to_alias} <#{to}>
Subject: #{subject}
#{message}
END_OF_MESSAGE
Net::SMTP.start('localhost') do |smtp|
smtp.send_message msg, from, to
end
end

Satish Talim
What a coincidence, I juts wrote a similar program on our group blog…
Link | August 2nd, 2006 at 2:38 pm
Satish Talim
One more thing, which Wordpress plugin are you using for code on your blog?
Link | August 2nd, 2006 at 2:40 pm
Ian Purton
I am not using a wordpress plugin, I hand code the entries then I have some css to style them.
Please feel free to look at the HTML and stylesheets.
Link | August 2nd, 2006 at 3:17 pm
abhi
i m trying to send mail with the given code of net::smtp.start().
but it give me error like
Address family not supported by protocol - socket(2)
/opt/lampp/lib/ruby/1.8/net/protocol.rb:206:in `initialize’
/opt/lampp/lib/ruby/1.8/net/protocol.rb:206:in `old_open’
/opt/lampp/lib/ruby/1.8/timeout.rb:56:in `timeout’
/opt/lampp/lib/ruby/1.8/timeout.rb:76:in `timeout’
/opt/lampp/lib/ruby/1.8/net/protocol.rb:206:in `old_open’
/opt/lampp/lib/ruby/1.8/net/smtp.rb:393:in `do_start’
/opt/lampp/lib/ruby/1.8/net/smtp.rb:378:in `start’
/opt/lampp/lib/ruby/1.8/net/smtp.rb:316:in `start’
app/controllers/hello_controller.rb:15:in `deliverMail’
Link | March 28th, 2007 at 4:50 am
sathyz
Ian.. I followed the steps and it works.. Thanks..
I have to add 2 things here.. We need to install postfix (not sure what to install in windows machine) and add require ‘net/smtp’ ..
Hope the problem with Abi is she might not have installed postfix.
Link | February 15th, 2008 at 6:27 am
Jaime Cruz
Hello, I used an works… Thank you.
Link | December 14th, 2008 at 3:54 pm
zibex
rs9VJq hi! nice site!
Link | January 21st, 2009 at 5:17 pm
Bernie Loriaga
Hi…I know its late…How can I send message?I try to run this code and it has no error,my problem is I don’t know how to use it.Thanks.
Link | February 19th, 2009 at 8:23 pm
Alexwebmaster
Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru
Link | March 3rd, 2009 at 6:22 am