Forum: Ruby on Rails sending email

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ba15b74b5b6e757a0a69a4ade447c564?d=identicon&s=25 Nagesh Sangana (nagesh)
on 2007-07-23 15:17
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...'
 def index
      render :file => 'app\views\emailer\index.rhtml'


and model as:
class Emailer < ActionMailer::Base
  def contact(recipient, subject, message, sent_at =
      @subject = subject
      @recipients = recipient
      @from = ''
      @sent_on = sent_at
    @body["title"] = 'This is title'
      @body["email"] = ''
       @body["message"] = message
      @headers = {}


in environment.rb i had given like this:
ActionMailer::Base.delivery_method =:sendmail
ActionMailer::Base.server_settings = {
:address => "localhost",
:port => 25,
:domain => "",
 :authentication => :login,
:user_name => "username",
:password => "password

and in app\views\emailer\contact.rhtml:

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

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


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..............
15c2efd46957daed9b4b4568802a2885?d=identicon&s=25 stephanie (Guest)
on 2007-07-23 19:18
(Received via mailing list)
If you like screencasts, there is a really good railscast primer on
sending email that was posted today.


On Jul 23, 6:17 am, Nagesh Sangana <>
This topic is locked and can not be replied to.