3.8k sao GitHub và vẫn tăng — ryanb/letter_opener là dự án Ruby mà TopGit đang theo dõi trên nền tảng. Preview mail in the browser instead of sending.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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
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:
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.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/ryanb/letter_opener là nguồn chính thức.
ryanb/letter_opener có bao nhiêu sao?
ryanb/letter_opener có 3.8k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/ryanb/letter_opener. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
ryanb/letter_opener có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho ryanb/letter_opener. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
ryanb/letter_opener còn đang phát triển không?
Commit gần nhất trên ryanb/letter_opener là 7 tháng trước (theo timestamp GitHub). Repo có 245 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
ryanb/letter_opener viết bằng ngôn ngữ gì?
ryanb/letter_opener chủ yếu viết bằng Ruby. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về letter_opener?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về letter_opener.