Capture Generated HTML

My app generates a web page.
What I would like to do is capture the final HTML output of the rendered page, after my code has constructed it with a variety of partials, into a variable so that I can tell the ‘swoosh’ emailer to use this captured rendering as the email’s body content.

Does anyone know how I could do this?

I think you can call:

To get the template.

1 Like

You probably want Phoenix.View.render_to_string/3 to get the iodata “flattened” out.


Thanks people.

paulsuulivanjr pointed me in the right direction and at the bottom of the HexDoc, I found the render_to_string()/3 function.