Action Mailer woes

Hi gang,
Im having my first stab at ActionMailer and not having any luck. Perhaps
someone could help me out.
I generated a a mailer called ItemMailer - its purpose is to take some
information that I’ve already gathered in a ToDo list form and to mail
it out to the person who is nominated for the task

In environment.rb I have;
ActionMailer::Base.server_settings = {
:address => “”,
:port => 25,
:authentication => :login,
:user_name => “[email protected]”,
:password => “wouldntyouliketoknow”

I have a Mailer model;
class ItemMailer < ActionMailer::Base
def item_assignment( address, title, body )
# Email header info MUST be added here
@recipients = address
@from = “[email protected]
@subject = title
@body = body

breakpoint ‘mailer’

  # Email body substitutions go here



In the controller I have;

Send the Email

@recipient = Person.find(:first, :conditions => [‘id =
@email_address = @recipient.email_address
ItemMailer::create_item_assignment(@email_address, @to_dos.title,

I dont need any fancy stuff like variable substitution, just a way to
pop the recipient, subject and body into an email object. When I try to
run this I get to the breakpoint OK so at least part of the controller
code is fine. After the breakpoint nothing happens. the app just chugs
along into the subsequent redirect and no mail is sent. There is nothing
in the development log to point to the problem

Can anyone help?
Kind Regards,

I believe your mistake is that you are trying to send form data but
you are treating it like ActiveRecord data. It took me a couple of
hours to get my head wrapped around it too. Try this in your

Send the Email

@email = ItemMailer.create_item_assignment(params
[:whatever_your_form_data_is]) #you didn’t post your form so its hard
to tell what variable to use here.
render :action => ‘some_action’

then in your model do the following:


You see if you’re trying to send a form then the data is an array NOT
ActiveRecord. I hope that helps.


Thanks for the response. I’m a step forward and another sideways
I now have;

class ItemMailer < ActionMailer::Base
def item_assignment( contact )
# Email header info MUST be added here
breakpoint ‘mailer’
@recipients = contact[:address]
@from = “[email protected]
@subject = contact[:title]
@body = contact[:body]

And in Controller;
def add_to_dos
@job = Job.find(params[:id])
@to_dos = params[‘to_do’])
@to_dos.update_attribute( ‘due_on’, params[:to_do][:due_on][:date] )
@to_dos.update_attribute(‘created_by’, ‘1’ )

Log the event

@j_evt = =>, :user_id => 1,
:event_type_id => @to_dos.to_do_type_id,
:title => @to_dos.title, :refer_id => )

# Send the Email
@recipient = Person.find(:first, :conditions => [‘id =
@email_address = @recipient.email_address
@contact = {:address =>@email_address, :title => @to_dos.title,
:body => @to_dos.body}
@email = ItemMailer::create_item_assignment(@contact)
flash[:notice] = ‘Item was successfully created.’
redirect_to :action => ‘job_dashboard’, :id => @job

Results In;

454 oops, unable to write pipe and I can’t auth (#4.3.0)

OK - I’m cool - still have a problem, but it is in the ISP
authentication stuff. MAny Thanks for your help.

Sorry - should have put the full trace

Net::SMTPAuthenticationError in Job#add_to_dos

454 oops, unable to write pipe and I can’t auth (#4.3.0)

RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace

d:/ruby/lib/ruby/1.8/net/smtp.rb:586:in auth_login' d:/ruby/lib/ruby/1.8/net/smtp.rb:571:insend
d:/ruby/lib/ruby/1.8/net/smtp.rb:571:in authenticate' d:/ruby/lib/ruby/1.8/net/smtp.rb:411:indo_start’
d:/ruby/lib/ruby/1.8/net/smtp.rb:378:in start' d:/ruby/lib/ruby/1.8/net/smtp.rb:316:instart’
perform_delivery_smtp' d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:327:insend’
deliver!' d:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:254:indeliver’
#{RAILS_ROOT}/app/controllers/job_controller.rb:188:in `add_to_dos’


Parameters: {“commit”=>“Save”, “to_do”=>{“sub_reference”=>"",
“body”=>“see how they run”, “title”=>“Blah Blah Black Sheep”,
“attachment”=>"", “user_id”=>“14”, “to_do_type_id”=>“5”,
“due_on”=>{“date”=>“01/30/2006”}}, “id”=>“1”, “todo”=>{“log_item”=>“0”,

Eric S. wrote:

OK - I’m cool - still have a problem, but it is in the ISP
authentication stuff. MAny Thanks for your help.

the account you are using is pop3 and not the smtp, so that may be your