# ActionMailer problem

**URL:** <https://www.ruby-forum.com/t/actionmailer-problem/107536>\
**Category:** Rails\
**Created:** [June 22, 2007, 7:44pm UTC](https://www.ruby-forum.com/t/actionmailer-problem/107536 "2007-06-22T19:44:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [June 22, 2007, 7:44pm UTC](https://www.ruby-forum.com/t/actionmailer-problem/107536/1 "2007-06-22T19:44:12Z")

</div>

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](http://smtp.outitgoes.com)”,  
:port =\> 25,  
:user\_name =\> “removed\_email\_address@domain.invalid”,  
: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.

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [June 24, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/actionmailer-problem/107536/2 "2007-06-24T19:15:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [June 24, 2007, 11:29am UTC](https://www.ruby-forum.com/t/actionmailer-problem/107536/3 "2007-06-24T11:29:55Z")

</div>

> 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)

---

<div class="post-metadata">

**Author:** ![lyntaff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@lyntaff](https://www.ruby-forum.com/u/lyntaff)\
**Post date:** [June 25, 2007, 9:19am UTC](https://www.ruby-forum.com/t/actionmailer-problem/107536/4 "2007-06-25T09:19:10Z")

</div>

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](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
