Redmine Email Logging Using Local Mail Relay (Postfix)

From Notes_Wiki

Home > CentOS > CentOS 6.x > Web based tools or applications > Redmine configuration > Redmine Email Logging Using Local Mail Relay (Postfix)


Redmine Email Logging Using Local Mail Relay (Postfix)

Use a local SMTP relay (Postfix) to send Redmine emails and enable logging both in log/mail.log (Redmine) and system logs (e.g., /var/log/maillog).

Why Use an SMTP Relay for Redmine?

Redmine does not retry sending emails if the SMTP server is unreachable at the time of notification. This behavior can lead to the loss of important email alerts (e.g., issue updates, password resets, notifications).

1. Create a Local SMTP Relay Server on the Redmine Server

Set up a local Postfix relay server on the same server where Redmine is installed. This relay will securely forward all outgoing mail to your organization's SMTP provider.

Follow this guide to set up the relay:

2. Configure Redmine to Use Local Relay

Edit configuration.yml in your Redmine directory:

# vim /opt/redmine/conf/configuration.yml

Update the file to use localhost (Postfix):

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "127.0.0.1"
      port: 25
      authentication: :none
      domain: 'gbb.co.in'
      enable_starttls_auto: false
      openssl_verify_mode: none



Enable Email Logging in Redmine

Edit production.rb in your Redmine directory:

# vi config/environments/production.rb

Look for and comment out this line if present:

# config.action_mailer.logger = nil

Append or modify the following lines:

config.action_mailer.logger = Logger.new(Rails.root.join('log', 'mail.log'))
config.action_mailer.logger.level = Logger::DEBUG
config.action_mailer.raise_delivery_errors = true

This sets up a dedicated mail.log file in the redmine/log/ directory with detailed logging enabled.

After saving your changes, restart your Redmine application:

# systemctl restart httpd

Monitor Logs

Redmine email log:

# tail -f /opt/redmine/log/mail.log

Postfix (relay server) mail log:

# tail -f /var/log/maillog


Home > CentOS > CentOS 6.x > Web based tools or applications > Redmine configuration > Redmine Email Logging Using Local Mail Relay (Postfix)