Created
February 15, 2011 04:03
-
-
Save addamh/827075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FormMailer < ActionMailer::Base | |
def send_form(email) | |
@email = email | |
mail(:to => "[email protected]", | |
:from => email[:from], | |
:subject => email[:subject]) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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