Created
December 27, 2010 18:09
-
-
Save kryali/756370 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
# app/mailers/user_mailer.rb | |
class UserMailer < ActionMailer::Base | |
default :from => "noreply@coursesillinois.com" | |
def welcome_email(user) | |
@user = user | |
@url = "http://coursesillinois.com/login" | |
mail(:to => "myemail@gmail.com", :subject => "Welcome to My Awesome Site") | |
end | |
end | |
# app/views/user_mailer/welcome_email.html.erb | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> | |
</head> | |
<body> | |
<h1>A new user has registered</h1> | |
<p>Let's see if you can get this email first though</p> | |
</body> | |
</html> | |
# where I call the welcome_email | |
def create | |
@user = User.create(params[:user]) | |
@user.save | |
UserMailer.welcome_email(@user).deliver | |
redirect_to(Post) | |
flash[:notice] = @user.errors | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment