Simple Email Send Function In Ruby

by ian.purton

If you need to send an e-mail in ruby, this little function works well.

This entry was posted on Tuesday, August 1st, 2006 at 1:20 pm and is filed under rails. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

  • 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.
  • Jaime Cruz
    Hello, I used an works... Thank you.
  • 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.
  • 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'
  • 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.
  • One more thing, which Wordpress plugin are you using for code on your blog?
  • What a coincidence, I juts wrote a similar program on our group blog...
blog comments powered by Disqus