Project

General

Profile

Using Project Custom Field as Return-Path in notification emails

Added by Charles So almost 9 years ago

We are on redline 3.0.1

Each Project will have 1 Custom Field.

We would like to use the value in this Custom Field to replace the default Return-Path value in email header.

I tried a quick and dirty method of setting it but it doesn't work.

It seems that the value is not obtained at all.

It would be nice if someone can help with this!

The change in vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb :

#  mail.smtp_envelope_from 'Mikel <mikel@test.lindsaar.net>'
    #  mail.smtp_envelope_from #=> 'mikel@test.lindsaar.net'
    def smtp_envelope_from( val = nil )
    val = issue.project.custom_field_values [ 0 ].value                      <----------------  new line
      if val
        self.smtp_envelope_from = val
      else
        @smtp_envelope_from || return_path || sender || from_addrs.first
      end
    end