can anyone tell me abt how to include email option in ror application. with code plz -- 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 -~----------~----~----~----~------~----~------~--~---
Nagesh Sangana wrote:> can anyone tell me abt > > how to include email option in ror application. > > with code > > > plzyou generate a model that is derived from ActionMailer, and via that class, you send mails. something like this ==================>> ruby script generate mailer MAILERNAME ==================in the models/MAILERNAME.rb file you''ll find: class MAILERNAME < ActionMailer::BASE #you need to define here a method to send emails: def some_email #here you put all of the headers of the email: @recipients = "me-32ZlmVLDByA@public.gmane.org" @from = "from Nagesh" @subject = "title of my email" # define type of email to send @content-type ''text/html'' # here you can pass variables to the email-template @body["variable"] = 123 end end ================now you need to write the email to send; this is in the views/MAILERNAME folder - the name of the template is the name of the method you defined in the model, so in our case it would be: views/MAILERNAME/some_email.rhtml # here you can write whatever email you want Hi, this is the email being sent... and what is here: "<%= @variable %>" should equal to ''123''! ================= now that you''ve set up the files, you need to send the email out: here''s how to do that, in the controller: .. .. def some_method .. .. #here: MAILERNAME::deliver_some_email #when you write down deliver_* you are basically sending the email out - ''deliver'' performs the sending out of the email; walla, you''re done. =============important notes however; you need to set up the config settings to some email server to send em out - you do this in the environment.rb file: something like this: ActionMailer::Base.server_settings = { :address => "localhost", :domain => ''www.yourdomain.com'', :port => 25 } (you need to configure this to your settings) and try it on production - it may not work in development mode. ========that''s it, really. here''s some good documentation on the subject: http://api.rubyonrails.org/files/vendor/rails/actionmailer/README.html ====== --shai -- 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.org/rails/pages/HowToSendEmailsWithActionMailer On Monday 23 July 2007 01:59:27 Nagesh Sangana wrote:> can anyone tell me abt > > how to include email option in ror application. > > with code > > > plz--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
is necessary to install stmp server in my system .... -- 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 -~----------~----~----~----~------~----~------~--~---
On 23 Jul 2007, at 14:15, Nagesh Sangana wrote:> is necessary to install stmp server in my system ....Either install your own or use your ISPs or hosting company''s SMTP server. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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 -~----------~----~----~----~------~----~------~--~---
On 23 Jul 2007, at 14:59, Nagesh Sangana wrote:> HI i am presently new to this ror language can you please send me the > stepwise procedure for sending the email ......http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer Or even better: buy the Agile Web Development with RoR book at http:// pragmaticprogrammer.com/titles/rails/ Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 give like this: --------------------- ActionMailer::Base.delivery_method = :sendmail ActionMailer::Base.smtp_settings = { :address => "smtp.postoffice.net", :port => 25, :domain => ''www.mywebsite.com'', :user_name => "me-S7oGPHmddGo0aPf6s/0I7w@public.gmane.org", :password => ''mypass'', :authentication => :login } But it is not working can any modifications necessary.... -- 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 -~----------~----~----~----~------~----~------~--~---
In addition to the other pointers. Ryan Davies has just done a screencast on this topic http://railscasts.com/episodes/61 On 7/23/07, Peter De Berdt <peter.de.berdt-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> > > On 23 Jul 2007, at 15:16, Nagesh Sangana wrote: > > 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 > > } > > > You either use sendmail or smtp: > > ActionMailer::Base.delivery_method =:smtp > > Best regards > > > Peter De Berdt > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 23 Jul 2007, at 15:16, Nagesh Sangana wrote:> 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 > }You either use sendmail or smtp: ActionMailer::Base.delivery_method =:smtp Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 kept this also but i cnot able to send email: can you provide me a stepwise procedure for sending email: ActionMailer::Base.delivery_method =:smtp -- 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 -~----------~----~----~----~------~----~------~--~---
On 23 Jul 2007, at 15:35, Nagesh Sangana wrote:> i had kept this also but i cnot able to send email: > > can you provide me a stepwise procedure for sending email: > > > > ActionMailer::Base.delivery_method =:smtpThere''s no more to it, you''ll have to use your common sense and the log files to find out what goes wrong. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---