I am unable to generate a message body using ActionMailer 3.
This problem occurs even for ActionMailer classes and views that are unchanged from Rails-2.3. When these files are run with Rails 2.3 emails with bodies result. When exactly the same files are used in a Rails 3 project the headers are produced but no body.
I am at a loss to explain this. Initially I thought that maybe the API had changed in such a fashion as to drop the old template naming convention. However, having reworked these files to use the new api exactly the same behaviour is observed, only headers are produced.
The new files are app/mailers/forex_mailer.rb and app/views/forex_mailer/forex_cacb_update_notice.plain.erb
app/mailers/forex_mailer.rb contains this method
def forex_cacb_update_notice( rates, to_address = 'xxxx@example.com', fm_address = 'yyyy@example.com' ) ... mail( :to => recipients, :from => fm_address, :subject => subject )
The call used to invoke this mailer is:
ForexMailer.forex_cacb_update_notice(rates, send_to).deliver
I therefore suspected that there must be something that has changed in how the templates are parsed. So, taking a hint from the API Readme I changed the name of the template files from x.plain.rb to x.text.plain.rb. This had no effect.
As these templates are a mixture of fixed text and interpolated ruby values I expected that I should see at least the fixed text portions of the templates in the message body, but I am seeing nothing at all. Inspection of the deliveries array shows this:
#<Mail::Message:23533088849320, Multipart: false, Headers: <Date: Mon, 25 Oct 2010 14:16:22 -0400>, <From: forex.control@harte-lyne.ca>, <To: forex.test@harte-lyne.ca>, <Message-ID: <4cc5c9769f540_1b3b156736d7d9b4140a6@inet05.hamilton.harte-lyne.ca.mail>>, <Subject: [ForEx] 2010-10-25 - Foreign Exchange Rates Central Bank Update Notice>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>> #<Mail::Body:0x2ace72cd5878 @raw_source="", @epilogue=nil, @charset="US-ASCII", @preamble=nil, @encoding="7bit", @parts=, @boundary=nil, @part_sort_order=["text/plain", "text/enriched", "text/html"]> #<Mail::Body:0x2ace72cd5878 @raw_source="", @epilogue=nil, @charset="US-ASCII", @preamble=nil, @encoding="7bit", @parts=, @boundary=nil, @part_sort_order=["text/plain", "text/enriched", "text/html"]>
Does anyone have any idea why the message body is not being generated from the templates provided?