-
Notifications
You must be signed in to change notification settings - Fork 237
Letter Opener Reply
andyl edited this page Aug 23, 2013
·
2 revisions
In my rails app, I did a simple hack to enable email replies from letter_opener. I did this to to simulate two-way email traffic in a group messaging system.
How it works:
- Override
LetterOpener::Message#template
- put this code inlib/letter_opener/alt_template
:
module LetterOpener
class Message
def template
File.read(File.expand_path("../message.html.erb", __FILE__))
end
end
end
-
Drop this template into
lib/letter_opener/message.html.erb
-
Add
require_relative "../lib/letter_opener/alt_template.rb"
toconfig/application.rb
. Now letter_opener should display the reply form. -
Create a controller
letter_opener_reply_controller.rb
and modifyroutes.rb
as needed. Now your rails app should process the letter_opener reply.
Hope that this tip is useful to someone else who would like to add a reply feature to letter_opener.