Skip to content

Instantly share code, notes, and snippets.

@addamh
Created February 15, 2011 04:03
Show Gist options
  • Save addamh/827075 to your computer and use it in GitHub Desktop.
Save addamh/827075 to your computer and use it in GitHub Desktop.
class PagesController < ApplicationController
def home
@title = "Home"
end
def crew
@title = "Crew"
end
def contact
@title = "Contact Us"
end
def services
@title = "What we can do"
end
def work
@title = "What we have done"
end
def send_mail
FormMailer.send_form(:from => params[:email]).deliver
flash[:notice] = "Email was succesfully sent."
end
end
class FormMailer < ActionMailer::Base
def send_form(email)
@email = email
mail(:to => "[email protected]",
:from => email[:from],
:subject => email[:subject])
end
end
ThreePipe::Application.routes.draw do
match '/contact', :to => 'pages#contact'
match '/crew', :to => 'pages#crew'
match '/services', :to => 'pages#services'
match '/work', :to => 'users#work'
match '/send_form', :to => 'form_mailer#send_form'
root :to => 'pages#home'
end
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<body>
<h1>Welcome to example.com, <%= @email[:name] %></h1>
<p>
You have successfully signed up to example.com,
your username is: <%= @email[:email] %>.<br/>
</p>
<p>
To login to the site, just follow this link: <%= @url %>.
</p>
<p>Thanks for joining and have a great day!</p>
</body>
</html>
Sample Sent Email in Text Form
==============================
email[:from]
email[:subject]
email[:body]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment