Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove mail html content from Rails' logs?

After an email has been delivered, the entire content of the email is visible in the logs in production, which is really messy. Can I remove the email content from the logs just in production?

like image 884
Kristoph Matthews Avatar asked Mar 03 '18 16:03

Kristoph Matthews


People also ask

What is Actionmailer?

Action Mailer is the Rails component that enables applications to send and receive emails. In this chapter, we will see how to send an email using Rails. Let's start creating an emails project using the following command. tp> rails new mailtest. This will create the required framework to proceed.

How do I Preview mailers in Rails?

Then the preview will be available in http://localhost:3000/rails/mailers/user_mailer/welcome_email. If you change something in app/views/user_mailer/welcome_email. html. erb or the mailer itself, it'll automatically reload and render it so you can visually see the new style instantly.


1 Answers

ActionMailer::Base.logger = nil

or in your config/environments/{development,test,production}.rb, add :

Rails.application.configure do
  ...
  config.action_mailer.logger = nil
  ...
end
like image 190
Ben Avatar answered Oct 05 '22 05:10

Ben