Sha256: 12fe1d317f8c454d13837b789d8e1e814ba99b5deae92669a802b50fa8f0acc4

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

module Bently

  class ActionMailer < RailsRecipe

    homepage 'http://guides.rubyonrails.org/action_mailer_basics.html'

    def initialize
      generate 'mailer UserMailer'
      insert 'app/mailers/user_mailer.rb', welcome_email_method, :after => /^.*default.*$/
      create './app/views/user_mailer/welcome_email.html.erb', welcome_email_html
      create './app/views/user_mailer/welcome_email.text.erb', welcome_email_text
    end

    protected

    def welcome_email_method
%{
  # def welcome_email(user)
  #   @user = user
  #   @url  = "http://example.com/login"
  #   mail(:to => user.email, :subject => "Welcome to My Awesome Site")
  # end
}
    end

    def welcome_email_html
%{
<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
    <h1>Welcome to example.com, <%= @user.name %></h1>
    <p>
      You have successfully signed up to example.com,
      your username is: <%= @user.login %>.<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>
}
    end

    def welcome_email_text
%{
Welcome to example.com, <%= @user.name %>
===============================================

You have successfully signed up to example.com,
your username is: <%= @user.login %>.

To login to the site, just follow this link: <%= @url %>.

Thanks for joining and have a great day!
}
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bently-1.0.0 lib/bently/recipe/action-mailer.rb