I am sending a standard email with Rails like this
@mail = mail(to: registration.user.email, subject: "Registration Confirmation: #{@site.name}")
Now I need to get the message body (or html in this case) from the message. I tried the following, but it does not work, since it does not return the processed message, but rather a template (including ERB and Haml).
@mail.body
@mail.body.raw_source
@mail.body.encoded
It seems surprisingly hard to do. I need the result that people see when they receive email.
Update
ERB and Haml I saw HTML comment, so in the logs it looked like it was logged in ERB instead of the displayed tempalte. So @ mail.body.encoded is working fine.
source
share