On Fri, May 27, 2011 at 7:32 PM, Stephen Huey <stephenh...@gmail.com> wrote:

> David, that's exactly what I did to solve the problem!  I renamed the
> instance variable and started seeing my string inserted into the
> email.  Using @body was definitely an issue for some reason.
>
> Great... I vaguely recall that I had the same issue, hence the name. I
think I decided that @body must be reserved or used by rails somewhere.
Anyhow, glad it helped!


> Thanks,
> Stephen
>
>
>
> On May 27, 6:00 pm, David Kahn <d...@structuralartistry.com> wrote:
> > On Fri, May 27, 2011 at 4:40 PM, Stephen Huey <stephenh...@gmail.com>
> wrote:
> > > Action Mailer is detecting my HTML view but not evaluating any
> > > instance variables I'm referencing in it.  Here is my mailer:
> >
> > > class Emailer < ActionMailer::Base
> >
> > >  def send_default(recipient, subject, message, sent_at)
> > >    @body = message
> > >    mail(:to => recipient, :subject => subject)
> > >  end
> >
> > > end
> >
> > > I have a view called
> >
> > > <!DOCTYPE html>
> > > <html>
> > >  <head>
> > >    <meta content="text/html; charset=UTF-8" http-equiv="Content-
> > > Type" />
> > >  </head>
> > >  <body>
> > >    This is an HTML email: <br />
> > >    <%= @body %>
> > >    <br />
> > >    End of the body.
> > >  </body>
> > > </html>
> >
> > Hmmm... I just checked as I am doing just about the same thing. Your code
> > looks ok, the only difference with mine is I am naming the class variable
> > @body_text. I am wondering if @body for you might be getting renamed
> > somewhere? Its a long shot but try renaming the variable. Also, you can
> put
> > a break point inside the mailer view I think ---  <%= debugger; @body
> %>....
> > then you can really see what is getting in there.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > When I receive the email in Gmail, here is all I see:
> >
> > > This is an HTML email:
> >
> > > End of the body.
> >
> > > Nothing is outputted between those 2 sentences!  Any ideas as to
> > > what's happening?  I verified that in the mailer method, @body has a
> > > value.  I'm using Rails 3.0.7 and Ruby 1.9.2 and following this guide:
> >
> > >http://guides.rubyonrails.org/action_mailer_basics.html
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Ruby on Rails: Talk" group.
> > > To post to this group, send email to rubyonrails-talk@googlegroups.com
> .
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to