Rails and Return-Path

How can I prevent Rails from stripping @header['Return-Path'] in an outgoing e-mail? No matter what RFC says, there are some situations where it is desirable to set an explicit Return Path, for instance to handle bounces.

PeterB wrote:

How can I prevent Rails from stripping @header['Return-Path'] in an outgoing e-mail?

I've been wondering the same. In our application we have a need to place a generated hash into the return path for tracking purposes. I have looked through the ActionMailer code, and it appears that TMail is responsible for removing the return-path header field.

Can someone suggest a way to preserve the return-path that we have set?

Thanks,

Cory

I've looked further into this, and it is TMail which for some
inexplicable reason (overzealous compliance with RFC, possibly)
strips the Return-Path header from all outgoing mail. I'll be writing
to the author for clarification as to the exact reasons for this kind
of Orwellian behaviour. Meanwhile, a work-around is to override the
following method in your Mailer subclass:

class Mailer < ActionMailer::Base