-
Notifications
You must be signed in to change notification settings - Fork 7
Mailers
cgebken edited this page Nov 6, 2020
·
3 revisions
Beyond Canvas comes with a mailer layout you can use for styling your emails. It is responsive and compatible with the most common email clients.
The mailer layout offers various partials that can be rendered in the email (see example below):
Partial | Accepted variables |
---|---|
beyond_canvas/mailer/text |
&block |
beyond_canvas/mailer/button |
locals[:url] (the URL of the button) and locals[:text] (the button text) |
-
Set
layout 'beyond_canvas/mailer'
on yourApplicationMailer
:# app/mailers/application_mailer.rb class ApplicationMailer < ActionMailer::Base layout 'beyond_canvas/mailer' end
-
Create your mailer and method as usual:
# app/mailers/user_mailer.rb class UserMailer < ApplicationMailer def welcome_email # ... end end
-
Make use of the Beyond Canvas mailer partials on your mailer view:
<!-- app/views/user_mailer/welcome_email.html.erb --> <%= render 'beyond_canvas/mailer/text' do %> Welcome to our awesome app. <% end %> <%= render 'beyond_canvas/mailer/button', locals: { url: 'https://epages.com', text: 'Visit our website' } %>
- Home
- Getting Started
- Configuration
-
Customization
- Rails
- CSS
- JavaScript
- Forms
- How-to articles