ryanb / letter_opener

Preview mail in the browser instead of sending.
MIT License
3.71k stars 236 forks source link

Add raw template to show headers and content for debugging #217

Open cschilbe opened 1 month ago

cschilbe commented 1 month ago

Why was this PR created

In some cases, it is useful to be able to see the raw message including all headers. This is useful in debugging headers and/or body content.

This resolves #218

What is included in this PR

raw.html.erb includes all the parsed content of the default template but also displays the raw content of the email body.

nashby commented 1 month ago

@cschilbe hey! Thanks for the PR but I'm not sure that's something this gem needs (as we try to keep it as simple as possible) since you can just open devtools and see raw content of the email. Or are there something that you can't see in devtools?

cschilbe commented 1 month ago

@cschilbe hey! Thanks for the PR but I'm not sure that's something this gem needs (as we try to keep it as simple as possible) since you can just open devtools and see raw content of the email. Or are there something that you can't see in devtools?

In my case mail is processed by interceptors that alter or add headers when sent. Specifically the X-SMTP headers used by sendgrid. This makes it difficult to preview the final version with all headers.

This seemed like a pretty simple and beneficial addition to the gem especially given the existing template mechanism but understandable that you'd not want to introduce unnecessary features.