Project

General

Profile

Actions

Patch #12493

closed

Fill the Return-Path email header with the correct email address

Added by Jérôme BATAILLE over 11 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email notifications
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Value to use : Setting.mail_from

Patch made from Rails 1.2.1, I suppose it will work with more recent versions


Files

add_return_path_header.diff (575 Bytes) add_return_path_header.diff Jérôme BATAILLE, 2012-12-03 17:16
add_return_path_header.diff (575 Bytes) add_return_path_header.diff Jérôme BATAILLE, 2012-12-03 17:18
40-actionmailer_base_patch.rb (1.9 KB) 40-actionmailer_base_patch.rb Jérôme BATAILLE, 2013-07-23 17:59
40-actionmailer_base_patch.rb (1.85 KB) 40-actionmailer_base_patch.rb domain name email address to adapt to your company Jérôme BATAILLE, 2013-07-23 18:05
Actions #2

Updated by Jérôme BATAILLE over 11 years ago

Sorry the first patch is wrong

Actions #3

Updated by Jan Niggemann (redmine.org team member) about 11 years ago

RFC2821:
When the delivery SMTP server makes the "final delivery" of a message, it inserts a return-path line at the beginning of the mail data.

http://stackoverflow.com/questions/1235534/what-is-the-behavior-difference-between-return-path-reply-to-and-from:
The Return-Path (sometimes called the Reverse-Path or Envelope-FROM -- all of these terms can be used interchangeably) is the value used during the SMTP session. As you can see, this does not need to be the same value that is actually found in the mail headers. Only the recipient's mail server is supposed to add a Return-Path header to the top of the email. This records the actual Return-Path sender during the SMTP session. If a Return-Path header is already exists in the email, then that header is to be removed, and replaced by the recipient's mail server.

Reading this, I don't think we need to implement this, what do you think?

Actions #4

Updated by Jérôme BATAILLE over 10 years ago

Hi again, I had to add a Return-Path header in emails send by a Redmine instance.
I think that only the sender can determine a correct (non default) Return-Path.
The case is the following :
E-mails are send with the default email address :
But we want that the real user initiating the action receives the bounce emails, because he will be the one knowing how to fix wrong recipients emails (and not the application adminstrators that have other cats to whip :-) ).
We use this and it works perfectly well with exim on the application server and zimbra as the final company mail server.

Actions #5

Updated by Jérôme BATAILLE over 10 years ago

Here is a patch based on ActionMailer (override of actionmailer-2.3.14/lib/action_mailer/base.rb)
to put in config/initializers/

So no need of a Redmine update

Actions #7

Updated by Jérôme BATAILLE almost 10 years ago

We now override the Mailer model initialize method

with :

         def initialize_with_return_path(*args)
            initialize_without_return_path(*args)

            # Specific : Return-path changed for the user making the change
            # Only for company members (*@[country_iso_code.]smile[-<country>].[extension])
            if (
              User.current.mail.present? &&
              (
                # A regexp to identify your company users by their email
                # You can use something else
                /@([a-z]+\.)?smile(-[a-zA-Z1-9]+|)?\.[a-z]+$/.match(User.current.mail)
              )
            )
              headers['Return-Path'] = User.current.mail
              # Rails.logger.debug "==>mail Return-Path=#{headers['Return-Path']} (#{User.current.mail})" 
            end
            # END -- Specific
          end

Actions #8

Updated by Jérôme BATAILLE almost 10 years ago

  • Status changed from New to Resolved

This patch is specific to each company, so it can't be integrated to the code core.

Actions #9

Updated by Toshi MARUYAMA almost 10 years ago

  • Status changed from Resolved to Closed
Actions #10

Updated by Jérôme BATAILLE about 7 years ago

Hi, you can indicate in the Resolution that's it Won't be Fixed, if you have the time to, thanks a lot.

Actions #11

Updated by Toshi MARUYAMA almost 7 years ago

Jérôme BATAILLE wrote:

Hi, you can indicate in the Resolution that's it Won't be Fixed, if you have the time to, thanks a lot.

"Patch" tracker does not have "Resolution" filed.

Actions

Also available in: Atom PDF