HI i am presently new to this ror language can you please send me the stepwise procedure for sending the email ...... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer On 7/23/07, Nagesh Sangana <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > HI i am presently new to this ror language can you please send me the > stepwise procedure for sending the email ...... > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i had generated the controller as: ------------------------------------- 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 => ''Sucessfully sent a mail...'' end def index render :file => ''app\views\emailer\index.rhtml'' end end and model as: ------------ class Emailer < ActionMailer::Base def contact(recipient, subject, message, sent_at = Time.now) @subject = subject @recipients = recipient @from = ''no-reply-FBj3rGVNSac4Q++5jOxPmw@public.gmane.org'' @sent_on = sent_at @body["title"] = ''This is title'' @body["email"] = ''sender-FBj3rGVNSac4Q++5jOxPmw@public.gmane.org'' @body["message"] = message @headers = {} end end in environment.rb i had given like this: ---------------------------------------- ActionMailer::Base.delivery_method =:sendmail ActionMailer::Base.server_settings = { :address => "localhost", :port => 25, :domain => "gmail.com", :authentication => :login, :user_name => "username", :password => "password } and in app\views\emailer\contact.rhtml: --------------------------------------- Hi! You are having one email message from <%= @email %> with a tilte <%= @title %> and following is the message: <%= @message %> Thanks and in app\views\emailer\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 %> but still i cannot able to send the mails.... what are the changes required please kindly send me code.............. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you like screencasts, there is a really good railscast primer on sending email that was posted today. http://railscasts.com/episodes/61 -STephanie On Jul 23, 6:17 am, Nagesh Sangana <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> i had generated the controller as: > ------------------------------------- > 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 => ''Sucessfully sent a mail...'' > end > def index > render :file => ''app\views\emailer\index.rhtml'' > end > > end > > and model as: > ------------ > class Emailer < ActionMailer::Base > def contact(recipient, subject, message, sent_at = Time.now) > @subject = subject > @recipients = recipient > @from = ''no-re...-FBj3rGVNSac4Q++5jOxPmw@public.gmane.org'' > @sent_on = sent_at > @body["title"] = ''This is title'' > @body["email"] = ''sen...-FBj3rGVNSac4Q++5jOxPmw@public.gmane.org'' > @body["message"] = message > @headers = {} > end > > end > > in environment.rb i had given like this: > ---------------------------------------- > ActionMailer::Base.delivery_method =:sendmail > ActionMailer::Base.server_settings = { > :address => "localhost", > :port => 25, > :domain => "gmail.com", > :authentication => :login, > :user_name => "username", > :password => "password > > } > > and in app\views\emailer\contact.rhtml: > --------------------------------------- > Hi! > > You are having one email message from <%= @email %> with a tilte > > <%= @title %> > and following is the message: > <%= @message %> > > Thanks > > and in app\views\emailer\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 %> > > but still i cannot able to send the mails.... what are the changes > required please kindly send me code.............. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---