# Controller mail method

**URL:** <https://www.ruby-forum.com/t/controller-mail-method/173904>\
**Category:** Deployment\
**Created:** [August 18, 2009, 12:46am UTC](https://www.ruby-forum.com/t/controller-mail-method/173904 "2009-08-18T00:46:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpaxton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@mpaxton](https://www.ruby-forum.com/u/mpaxton)\
**Post date:** [August 18, 2009, 12:46am UTC](https://www.ruby-forum.com/t/controller-mail-method/173904/1 "2009-08-18T00:46:59Z")

</div>

I have the following method in my controller:

def send\_contact\_request  
@contact = Contact.new(params[‘contact’])  
if @contact.save  
begin  
Mailer::deliver\_contact\_message(@contact)  
flash[:notice] = "Success!â€  
redirect\_to :action =\> “contact”  
rescue  
flash[:notice] = â€œIt broke!â€  
render :action=\>“contact”  
end  
else  
render :action=\>“contact”  
end  
end

```
end

```

When I try to run the project, I get the following error:

C:/rubyapps/fcalc/app/controllers/numbers\_controller.rb:96: syntax  
error, unexpected tIDENTIFIER, expecting kEND  
redirect\_to :action =\> “contact”  
^  
C:/rubyapps/fcalc/app/controllers/numbers\_controller.rb:99: syntax  
error, unexpected tIDENTIFIER, expecting kEND  
render :action=\>“contact”  
^  
C:/rubyapps/fcalc/app/controllers/numbers\_controller.rb:102: syntax  
error, unexpected tIDENTIFIER, expecting kEND  
render :action=\>“contact”  
^  
C:/rubyapps/fcalc/app/controllers/numbers\_controller.rb:102:  
unterminated string meets end of file  
C:/rubyapps/fcalc/app/controllers/numbers\_controller.rb:102: syntax  
error, unexpected $end, expecting kEND

I sure it’s staring me in the face, but I have been looking at it so  
long I can’t see it

---

<div class="post-metadata">

**Author:** ![mpaxton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@mpaxton](https://www.ruby-forum.com/u/mpaxton)\
**Post date:** [August 18, 2009, 1:35am UTC](https://www.ruby-forum.com/t/controller-mail-method/173904/2 "2009-08-18T01:35:45Z")

</div>

ok, figured it out.
