<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:refactormycode.com,2007:users49</id>
  <link type="application/atom+xml" href="http://refactormycode.com/users/49" rel="self"/>
  <title>phill</title>
  <updated>Sat Mar 01 19:19:54 +0000 2008</updated>
  <entry>
    <id>tag:refactormycode.com,2007:Code246</id>
    <published>2008-03-01T19:19:54+00:00</published>
    <updated>2008-11-20T07:34:46+00:00</updated>
    <title>[Ruby] Action Mailer - It has to be easier?</title>
    <content type="html">&lt;p&gt;Here is a FormMailer that I have.  As you know, ActionMailer is a Model not a controller.  But I have yet to figure out how to reduce this to one method instead of 20...&lt;/p&gt;

&lt;pre&gt;class FormMailer &amp;lt; ActionMailer::Base

  def contact_us(params)
    from params[:email]
    recipients params[:to]
    subject params[:subject]
    body :params =&amp;gt; params
  end

  def help_request(params)
    from params[:email]
    recipients params[:to]
    subject params[:subject]
    body :params =&amp;gt; params
  end

  def service(params)
    from params[:email]
    recipients params[:to]
    subject params[:subject]
    body :params =&amp;gt; params
  end

  def customer_care(params)
    from params[:email]
    recipients params[:to]
    subject params[:subject]
    body :params =&amp;gt; params
  end

  def tellafriend(params)
    from params[:from_email]
    recipients params[:friend_email]
    headers 'Disposition-Notification-To' =&amp;gt; params[:from_email] if params[:notify] == 'yes'
    subject params[:subject]
    body :params =&amp;gt; params
  end

  # snip... 20 more
end
&lt;/pre&gt;</content>
    <author>
      <name>phill</name>
      <email>phill@kenoyer.com</email>
    </author>
    <link type="text/html" href="http://refactormycode.com/codes/246-action-mailer-it-has-to-be-easier" rel="alternate"/>
  </entry>
</feed>
