Render a Swoosh.Email struct as "raw" email text

I’m wondering if there’s a way (i.e. a Swoosh.Adapters.*) to render an email struct directly as the full, raw email? I would like to see all headers and all multipart/mixed attachments in full.

1 Like

Maybe try the Logger adapter.

1 Like

This is what I eventually found, though since the module isn’t documented, it may be subject to change:

email = %Swoosh.Email{...}
raw_email_txt = Swoosh.Adapters.SMTP.Helpers.body(email, [])
File.write("raw_email.eml", raw_email_txt)

On macOS at least I can open that using Mail.app and it’ll render. What I was checking here was that I could include inline images as attachments, referenced in the HTML as <img src="cid:logo.png" />.

1 Like