Created
March 28, 2011 15:52
-
-
Save thbishop/890707 to your computer and use it in GitHub Desktop.
calling the mailer
This file contains hidden or 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
| @user = User.invite_without_notification! | |
| @group = Group.find_by_name('foo') | |
| @group.memebers << @user | |
| GroupMailer.welcome_invitation(@group, @user).deliver |
This file contains hidden or 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 GroupMailer < ActionMailer::Base | |
| default :from => "support@example.com" | |
| def welcome_invitation(group, user) | |
| @group = group | |
| @user = user | |
| mail(:to => user.email, :subject => 'A group has been shared with you') | |
| end | |
| end |
This file contains hidden or 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
| <p>Hello <%= @user.email %>!</p> | |
| <p>Someone has invited you to join a group called <%= @group.name %> on <%= root_url %>, you can accept it through the link below.</p> | |
| <p><%= link_to 'Accept invitation', accept_invitation_url(@user, :invitation_token => @user.invitation_token) %></p> | |
| <p>If you don't want to accept the invitation, please ignore this email.<br /> | |
| Your account won't be created until you access the link above and set your password.</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment