diff --git a/README.md b/README.md index c75fdda3..31381b9e 100644 --- a/README.md +++ b/README.md @@ -113,3 +113,20 @@ This feed can be paged through using the parameters `per_page` and `page`, like ``` https://pdc-discovery-staging.princeton.edu/discovery/pppl_reporting_feed.json?per_page=2&page=3 ``` + +## Mail + +### Mail on Development +Mailcatcher is a gem that can also be installed locally. See the [mailcatcher documentation](https://mailcatcher.me/) for how to run it on your machine. + +### Mail on Staging +To See mail that has been sent on the staging server you can utilize capistrano to open up both mailcatcher consoles in your browser. + +``` +cap staging mailcatcher:console +``` + +Look in your default browser for the consoles + +### Mail on Production +Emails on production are sent via [Pony Express](https://github.com/pulibrary/pul-it-handbook/blob/f54dfdc7ada1ff993a721f6edb4aa1707bb3a3a5/services/smtp-mail-server.md). diff --git a/config/deploy.rb b/config/deploy.rb index fe3cc105..5179caea 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -30,3 +30,21 @@ # Uncomment to re-index on every deploy. Only needed when we're actively # updating how indexing happens. # after "deploy:published", "pdc_discovery:reindex" + +namespace :mailcatcher do + desc "Opens Mailcatcher Consoles" + task :console do + on roles(:app) do |host| + mail_host = host.hostname + user = "pulsys" + port = rand(9000..9999) + puts "Opening #{mail_host} Mailcatcher Console on port #{port} as user #{user}" + Net::SSH.start(mail_host, user) do |session| + session.forward.local(port, "localhost", 1080) + puts "Press Ctrl+C to end Console connection" + `open http://localhost:#{port}/` + session.loop(0.1) { true } + end + end + end +end \ No newline at end of file