DEV: replace mailcatcher references with mailhog (#14500)

This commit is contained in:
Arpit Jalan 2021-10-05 15:48:06 +05:30 committed by GitHub
parent fbe9cd49b6
commit fbeb854ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 9 deletions

View File

@ -8,5 +8,5 @@ Discourse::Application.initialize!
# When in "dev" mode, ensure we won't be sending any emails # When in "dev" mode, ensure we won't be sending any emails
if Rails.env.development? && ActionMailer::Base.smtp_settings != { address: "localhost", port: 1025 } if Rails.env.development? && ActionMailer::Base.smtp_settings != { address: "localhost", port: 1025 }
fail "In development mode, you should be using mailcatcher otherwise you might end up sending thousands of digest emails" fail "In development mode, you should be using mailhog otherwise you might end up sending thousands of digest emails"
end end

View File

@ -42,7 +42,7 @@ Discourse::Application.configure do
config.handlebars.precompile = true config.handlebars.precompile = true
# we recommend you use mailcatcher https://github.com/sj26/mailcatcher # we recommend you use mailhog https://github.com/mailhog/MailHog
config.action_mailer.smtp_settings = { address: "localhost", port: 1025 } config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true

View File

@ -29,7 +29,7 @@ Discourse::Application.configure do
# Specifies the header that your server uses for sending files # Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# we recommend you use mailcatcher https://github.com/sj26/mailcatcher # we recommend you use mailhog https://github.com/mailhog/MailHog
config.action_mailer.smtp_settings = { address: "localhost", port: 1025 } config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
# Send deprecation notices to registered listeners # Send deprecation notices to registered listeners

View File

@ -24,7 +24,7 @@ To get your Ubuntu 16.04 or 18.04 LTS install up and running to develop Discours
rvm install 2.6.2 rvm install 2.6.2
rvm --default use 2.6.2 # If this error out check https://rvm.io/integration/gnome-terminal rvm --default use 2.6.2 # If this error out check https://rvm.io/integration/gnome-terminal
gem install bundler mailcatcher rake gem install bundler rake
# Download and install postgresql-10 from https://wiki.postgresql.org/wiki/Apt # Download and install postgresql-10 from https://wiki.postgresql.org/wiki/Apt
@ -75,9 +75,12 @@ If you ever need to recreate your database:
bundle exec rake admin:create bundle exec rake admin:create
RAILS_ENV=test bundle exec rake db:drop db:create db:migrate RAILS_ENV=test bundle exec rake db:drop db:create db:migrate
Configure emails via MailHog (https://github.com/mailhog/MailHog):
docker run -p 8025:8025 -p 1025:1025 mailhog/mailhog # open http://localhost:8025 to see the emails
Discourse does a lot of stuff async, so it's better to run sidekiq even on development mode: Discourse does a lot of stuff async, so it's better to run sidekiq even on development mode:
mailcatcher # open http://localhost:1080 to see the emails, stop with pkill -f mailcatcher
bundle exec sidekiq # open http://localhost:3000/sidekiq to see queues bundle exec sidekiq # open http://localhost:3000/sidekiq to see queues
bundle exec rails server bundle exec rails server

View File

@ -216,7 +216,7 @@ By default, development.rb will attempt to connect locally to send email.
config.action_mailer.smtp_settings = { address: "localhost", port: 1025 } config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
``` ```
Set up [MailCatcher](https://github.com/sj26/mailcatcher) so the app can intercept Set up [MailHog](https://github.com/mailhog/MailHog) so the app can intercept
outbound email and you can verify what is being sent. outbound email and you can verify what is being sent.
## Additional Image Tooling ## Additional Image Tooling

View File

@ -2,9 +2,9 @@
Some notes about testing Discourse: Some notes about testing Discourse:
## MailCatcher ## MailHog
Discourse depends heavily on (sending) email for notifications. We use [MailCatcher](https://mailcatcher.me/) Discourse depends heavily on (sending) email for notifications. We use [MailHog](https://github.com/mailhog/MailHog)
to test emails. It's super convenient! to test emails. It's super convenient!
> MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that's arrived so far. > MailHog runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailhog, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:8025 to see the mail that's arrived so far.