https://github.com/ryanb/letter_opener
Preview mail in the browser instead of sending.
https://github.com/ryanb/letter_opener
Keywords from Contributors
activerecord activejob mvc rubygem crash-reporting rspec rack authorization oauth2 sinatra
Last synced: about 15 hours ago
JSON representation
Repository metadata
Preview mail in the browser instead of sending.
- Host: GitHub
- URL: https://github.com/ryanb/letter_opener
- Owner: ryanb
- License: mit
- Created: 2011-09-07T21:17:22.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2024-08-02T07:09:54.000Z (over 1 year ago)
- Last Synced: 2025-12-14T20:59:39.943Z (6 days ago)
- Language: Ruby
- Homepage:
- Size: 231 KB
- Stars: 3,822
- Watchers: 31
- Forks: 243
- Open Issues: 5
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
README.md
Letter Opener 
Preview email in the default browser instead of sending it. This means you do not need to set up email delivery in your development environment, and you no longer need to worry about accidentally sending a test email to someone else's address.
Rails Setup
First add the gem to your development environment and run the bundle command to install it.
gem "letter_opener", group: :development
Then set the delivery method in config/environments/development.rb
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.perform_deliveries = true
Now any email will pop up in your browser instead of being sent. The messages are stored in tmp/letter_opener.
If you want to change application that will be used to open your emails you should override LAUNCHY_APPLICATION environment variable or set Launchy.application in the initializer.
Configuration
LetterOpener.configure do |config|
# To overrider the location for message storage.
# Default value is `tmp/letter_opener`
config.location = Rails.root.join('tmp', 'my_mails')
# To render only the message body, without any metadata or extra containers or styling.
# Default value is `:default` that renders styled message with showing useful metadata.
config.message_template = :light
# To change default file URI scheme you can provide `file_uri_scheme` config.
# It might be useful when you use WSL (Windows Subsystem for Linux) and default
# scheme doesn't work for you.
# Default value is blank
config.file_uri_scheme = 'file://///wsl$/Ubuntu-18.04'
end
Non Rails Setup
If you aren't using Rails, this can be easily set up with the Mail gem. Just set the delivery method when configuring Mail and specify a location.
require "letter_opener"
Mail.defaults do
delivery_method LetterOpener::DeliveryMethod, location: File.expand_path('../tmp/letter_opener', __FILE__)
end
The method is similar if you're using the Pony gem:
require "letter_opener"
Pony.options = {
via: LetterOpener::DeliveryMethod,
via_options: {location: File.expand_path('../tmp/letter_opener', __FILE__)}
}
Alternatively, if you are using ActionMailer directly (without Rails) you will need to add the delivery method.
require "letter_opener"
ActionMailer::Base.add_delivery_method :letter_opener, LetterOpener::DeliveryMethod, :location => File.expand_path('../tmp/letter_opener', __FILE__)
ActionMailer::Base.delivery_method = :letter_opener
Remote Alternatives
Letter Opener uses Launchy to open sent mail in the browser. This assumes the Ruby process is running on the local development machine. If you are using a separate staging server or VM this will not work. In that case consider using Mailtrap or MailCatcher.
If you are running your application within a Docker Container or VM and do not have a browser available to open emails received by Letter Opener, you may see the following error:
WARN: Launchy::CommandNotFoundError: Unable to find a browser command. If this is unexpected, Please rerun with environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at https://github.com/copiousfreetime/launchy/issues/new
To resolve this, simply set the following ENV variables:
LAUNCHY_DRY_RUN=true
BROWSER=/dev/null
In order to keep this project simple, I don't have plans to turn it into a Rails engine with an interface for browsing the sent mail but there is a gem you can use for that.
Development & Feedback
Questions or problems? Please use the issue tracker. If you would like to contribute to this project, fork this repository and run bundle and rake to run the tests. Pull requests appreciated.
Special thanks to the mail_view gem for inspiring this project and for their mail template. Also thanks to Vasiliy Ermolovich for helping manage this project.
Owner metadata
- Name: Ryan Bates
- Login: ryanb
- Email:
- Kind: user
- Description:
- Website: http://railscasts.com
- Location: Southern Oregon
- Twitter:
- Company: RailsCasts
- Icon url: https://avatars.githubusercontent.com/u/161?v=4
- Repositories: 63
- Last ynced at: 2023-04-09T06:01:35.951Z
- Profile URL: https://github.com/ryanb
GitHub Events
Total
- Commit comment event: 1
- Issues event: 2
- Watch event: 94
- Issue comment event: 4
- Pull request event: 1
- Pull request review event: 1
- Fork event: 6
Last Year
- Watch event: 69
- Issue comment event: 3
- Pull request event: 1
- Pull request review event: 1
- Fork event: 5
- Commit comment event: 1
Committers metadata
Last synced: 1 day ago
Total Commits: 252
Total Committers: 67
Avg Commits per committer: 3.761
Development Distribution Score (DDS): 0.591
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Vasiliy Ermolovich | y****h@g****m | 103 |
| Ryan Bates | r****n@r****m | 28 |
| David Cornu | d****u@g****m | 14 |
| Koichi ITO | k****o@g****m | 9 |
| Ryunosuke Sato | t****s@g****m | 7 |
| Olle Jonsson | o****n@g****m | 6 |
| Akira Matsuda | r****e@d****p | 4 |
| Kulgar | r****t@c****r | 3 |
| Jean Mertz | j****n@m****m | 2 |
| Kevin McPhillips | g****b@k****a | 2 |
| Mark Dodwell | m****k@m****k | 2 |
| Masato Nakamura | m****5@g****m | 2 |
| Paul Whitehead | p****d@g****m | 2 |
| Peter Goldstein | p****n@g****m | 2 |
| Philip Hallstrom | p****p@p****m | 2 |
| Samuel Cochran | s****6@s****m | 2 |
| Stan Carver | s****n@a****m | 2 |
| Tyler Collier | g****t@t****m | 2 |
| Wes Gibbs | w****s@g****m | 2 |
| centrevillage | c****e@g****m | 2 |
| Jared Beck | j****d@j****m | 2 |
| Fabio Rehm | f****m@g****m | 2 |
| Claire McGinty | c****y@g****m | 2 |
| Bruno Michel | b****l@m****o | 2 |
| Steve Tipton | s****n@e****m | 2 |
| Jacob Maine | p****e@c****o | 2 |
| Bram Plessers | w****n | 2 |
| sho shimohata | s****a@c****p | 1 |
| Søren Houen | h****n@p****k | 1 |
| Joseph Choi | j****h@b****m | 1 |
| and 37 more... | ||
Committer domains:
- snap2web.com: 1
- mbleigh.com: 1
- tilde.io: 1
- jmccc.com: 1
- makit.lv: 1
- sheffield.ac.uk: 1
- rikowski.info: 1
- danfinnie.com: 1
- cobychapple.com: 1
- free.fr: 1
- bouldersmiths.com: 1
- iprog.com: 1
- gurge.com: 1
- harmanly.com: 1
- layer22.com: 1
- bougie.ca: 1
- subelsky.com: 1
- boonedocks.net: 1
- brainlure.com: 1
- presenti.dk: 1
- crowdworks.co.jp: 1
- citizencode.io: 1
- employmentguide.com: 1
- menfin.info: 1
- jaredbeck.com: 1
- tylercollier.com: 1
- a1webconsulting.com: 1
- sj26.com: 1
- pjkh.com: 1
- mkdynamic.co.uk: 1
- kevinmcphillips.ca: 1
- mertz.fm: 1
- ct2c.fr: 1
- dio.jp: 1
- railscasts.com: 1
Issue and Pull Request metadata
Last synced: 9 days ago
Total issues: 55
Total pull requests: 66
Average time to close issues: about 2 months
Average time to close pull requests: about 2 months
Total issue authors: 54
Total pull request authors: 43
Average comments per issue: 4.55
Average comments per pull request: 1.68
Merged pull request: 48
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 2
Past year average comments per issue: 0
Past year average comments per pull request: 0.5
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- jamesst20 (2)
- jigarbhatt2711 (1)
- BakoviDagi (1)
- cassidyclawson (1)
- damienlethiec (1)
- sars (1)
- sappapp (1)
- miguelpeniche (1)
- eltiare (1)
- alpemaca (1)
- cpanderson (1)
- n-rodriguez (1)
- chaffeqa (1)
- patrickberkeley (1)
- coorasse (1)
Top Pull Request Authors
- olleolleolle (6)
- koic (6)
- amatsuda (4)
- m-nakamura145 (4)
- tricknotes (3)
- Kulgar (2)
- jaredbeck (2)
- sj26 (2)
- petergoldstein (2)
- cschilbe (2)
- gitKrystan (1)
- listrophy (1)
- pusewicz (1)
- arkirchner (1)
- nashby (1)
Top Issue Labels
- waiting (1)
Top Pull Request Labels
Package metadata
- Total packages: 3
-
Total downloads:
- rubygems: 203,047,226 total
- Total docker downloads: 962,774,794
- Total dependent packages: 80 (may contain duplicates)
- Total dependent repositories: 22,327 (may contain duplicates)
- Total versions: 50
- Total maintainers: 2
gem.coop: letter_opener
When mail is sent from your application, Letter Opener will open a preview in the browser instead of sending.
- Homepage: https://github.com/ryanb/letter_opener
- Documentation: http://www.rubydoc.info/gems/letter_opener/
- Licenses: MIT
- Latest release: 1.10.0 (published over 1 year ago)
- Last Synced: 2025-12-19T11:31:24.889Z (1 day ago)
- Versions: 18
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 101,503,198 Total
- Docker Downloads: 481,387,397
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.115%
- Docker downloads count: 0.212%
- Downloads: 0.248%
- Maintainers (2)
rubygems.org: letter_opener
When mail is sent from your application, Letter Opener will open a preview in the browser instead of sending.
- Homepage: https://github.com/ryanb/letter_opener
- Documentation: http://www.rubydoc.info/gems/letter_opener/
- Licenses: MIT
- Latest release: 1.10.0 (published over 1 year ago)
- Last Synced: 2025-12-20T11:30:55.505Z (about 16 hours ago)
- Versions: 18
- Dependent Packages: 80
- Dependent Repositories: 22,327
- Downloads: 101,544,028 Total
- Docker Downloads: 481,387,397
-
Rankings:
- Dependent repos count: 0.239%
- Docker downloads count: 0.26%
- Downloads: 0.27%
- Stargazers count: 0.371%
- Dependent packages count: 0.382%
- Average: 0.546%
- Forks count: 1.755%
- Maintainers (2)
proxy.golang.org: github.com/ryanb/letter_opener
- Homepage:
- Documentation: https://pkg.go.dev/github.com/ryanb/letter_opener#section-documentation
- Licenses: mit
- Latest release: v1.10.0 (published over 1 year ago)
- Last Synced: 2025-12-19T11:31:28.155Z (1 day ago)
- Versions: 14
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 1.123%
- Forks count: 1.797%
- Average: 5.824%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
Dependencies
- net-imap >= 0
- net-pop >= 0
- net-smtp >= 0
- rake >= 0
- mail ~> 2.6.0 development
- rspec ~> 3.10.0 development
- launchy >= 2.2, < 3
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
Score: 33.3312411469349