ryanb / letter_opener

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

Exposing Letter Opener File Save Path #207

Closed jonmchan closed 7 months ago

jonmchan commented 10 months ago

I was interested in knowing where the generated message was being located so that I can open it up in another application. This PR simply exposes the generated message path in the original Mail::Message object. Thought someone else might find this useful.

It exposes the rich and the plain version at:

mail['location-rich'].value
=> "/app/tmp/letter_opener/1700503091_0311892_1d5f48e/rich.html"
mail['location-plain'].value
=> "/app/tmp/letter_opener/1700503091_0311892_1d5f48e/plain.html"

This object is returned from mailers such as ActiveMailer after the mail is sent.

nashby commented 7 months ago

@jonmchan sorry it took that long to merge but I find it useful indeed! Thank you.

jonmchan commented 7 months ago

Thanks for merging @nashby ! If we can get a release, that would be awesome so I don't have to point to my custom branch in my Gemfile. Thanks!

nashby commented 7 months ago

@jonmchan hey! 1.9.0 has been released, please give it a try!

jonmchan commented 6 months ago

@nashby thanks so much - updated the gems and everything still works as expected!