ActionMailer problem

I’m a rails newbie and well into a new project. I’m using he
ActionMailer component for the first time but I keep getting an error
when executing it at the last step. I am passing some data through a
contact form that needs to be sent to a specific address, heres what I
have done so far.

First i setup the enviroment.rb with the ActionMailer configurations
like so:

config.action_mailer.delivery_method = :smtp

config.action_mailer.server_settings = {
:address => “smtp.outitgoes.com”,
:port => 25,
:user_name => “[email protected]”,
:password => “374884”,
:authentication => “login”
}

Then using the console I used the generate mailer script and created
all the necessary files in which edited the create model mailer class,
view for the email and then the controller like so:

def quote_send
quote = params[:quote]
QuoteMailer.deliver_send(quote)
end

When I access this controller i get this error: “wrong number of
arguments (2 for 1)”

Can somebody point me out whats wrong, I have checked my code and
can’t see any problems.

params[:quote] returns data thats been entered into a form. i still
don’t understand what i’m doing wrong.

def quote_send
quote = params[:quote]
QuoteMailer.deliver_send(quote)
end

When I access this controller i get this error: “wrong number of
arguments (2 for 1)”

what does params[:qoute] return? you are apperantely passing two
arguments to the QouteMailer#send method, where if you check in the
QouteMailer model, you only need one. (this is why is says “2 for 1”)

…i believe this is the problem, but if you post the :send method in
QouteMailer i’m sure we could debug a little further. (the problem lies
therein, i believe)

def quote_send
quote = params[:quote]
QuoteMailer.deliver_send(quote)
end

two things i have in mind:

in QouteMailer.rb , you apparently have a ‘send’ method defined there.
(hence the deliver_send(arg) ). this may be the cause of the error, as
the “send” may be a reserved word. (
http://dev.rubyonrails.org/ticket/6467 ). try changing the method to
something less generic such as

“def email” instead of “def send”, and then change the controller method
to QouteMailer.deliver_email(arg) ; maybe that will help.

second thing, if the above doesn’t work (hopefully this should be
enough) would be to dump the params[:qoute] and see what that returns,
as that could be the only other thing that is stopping this from
working.

shai

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs