From: Nikhil Khullar Date: 2013-01-31T17:19:32+09:00 Subject: Simple Mailer Switch Not Working Hello, Am a newbie to Ruby. Please help me find out why this snippet of code is failing and picking up the first case always: class ContactUsMailer < ActionMailer::Base default :from => "bot@spyders.in" def contact_us_email(name, message, purpose, email) @name = name @message = message @purpose = purpose @email = email content_type "text/html" case @purpose when 'android' mail(:to => 'admin@spyders.in', :subject => purpose) when 'marketing' mail(:to => 'admin@spyders.in', :cc => 'admin@spyders.in, admin@spyders.in', :subject => purpose) when 'ios' mail(:to => 'iosmaster@gmail.com', :subject => purpose) when 'recruitment' mail(:to => 'admin@spyders.in', :cc => 'admin@spyders.in', :subject => purpose) when 'general' mail(:to => 'admin@spyders.in', :subject => purpose) else mail(:to => 'admin@spyders.in', :subject => purpose) end end end Regards ! Attachments: http://www.ruby-forum.com/attachment/8094/contact_us_mailer.rb -- Posted via http://www.ruby-forum.com/.