Forum: Ruby on Rails Mail program error

8dd746bfd0983237307faaad7537ff32?d=identicon&s=25 bhanu bhanu (Guest)
on 2011-04-26 08:04
(Received via mailing list)
Iam new to ruby on rails

        I read the one of the article in mail program.iam trying to
execute
the program it shows the errors.here the error is


      execution expired

RAILS_ROOT: C:/emailexample
Application Trace | Framework Trace | Full Trace

C:/Ruby186/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'
C:/Ruby186/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
C:/Ruby186/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
C:/Ruby186/lib/ruby/1.8/net/protocol.rb:126:in `readline'
C:/Ruby186/lib/ruby/1.8/net/smtp.rb:663:in `recv_response'
C:/Ruby186/lib/ruby/1.8/net/smtp.rb:395:in `do_start'
C:/Ruby186/lib/ruby/1.8/net/smtp.rb:685:in `critical'
C:/Ruby186/lib/ruby/1.8/net/smtp.rb:395:in `do_start'
C:/Ruby186/lib/ruby/1.8/net/smtp.rb:377:in `start'
C:/Ruby186/lib/ruby/1.8/net/smtp.rb:315:in `start'
C:/Ruby186/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:627:in
`perform_delivery_smtp'
C:/Ruby186/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:508:in
`__send__'
C:/Ruby186/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:508:in
`deliver!'
C:/Ruby186/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:383:in
`method_missing'
app/controllers/emailer_controller.rb:8:in `sendmail'


here the program is




class Emailer < ActionMailer::Base
   def contact(recipient, subject, message, sent_at = Time.now)
      @subject = subject
      @recipients = recipient
      @from = 'no-reply@yourdomain.com'
      @sent_on = sent_at
    @body["title"] = 'This is title'
      @body["email"] = 'sender@yourdomain.com'
       @body["message"] = message
      @headers = {}
   end
end


contact.rhtml file
Hi!

You are having one email message from <%= @email %> with a tilte

<%= @title %>
and following is the message:
<%= @message %>

Thanks


class EmailerController < ApplicationController
   def sendmail
      email = @params["email"]
    recipient = email["recipient"]
    subject = email["subject"]
    message = email["message"]
      Emailer.deliver_contact(recipient, subject, message)
      return if request.xhr?
      render :text => 'Message sent successfully'
   end
 def index
      render :file => 'app\views\emailer\index.rhtml'
   end

end


index.rhtml
<h1>Send Email</h1>
<%= start_form_tag :action => 'sendmail' %>
<p><label for="email_subject">Subject</label>:
<%= text_field 'email', 'subject' %></p>
<p><label for="email_recipient">Recipient</label>:
<%= text_field 'email', 'recipient' %></p>
<p><label for="email_message">Message</label><br/>
<%= text_area 'email', 'message' %></p>
<%= submit_tag "Send" %>
<%= end_form_tag %>

please give me the solution
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.