Attached is a very useful patch, based on various blogs and mailing list posts I've read today.
The smtp Return-Path header SHOULD be used by MTAs to send bounce messages, quota warnings and delivery faillures. Most do, so this is a great header to use when you run mailing lists. Or when you want to automate bounce messages.
ActionMailer allows the Return-Path header to be changed just fine. But when passing the message for delivery via SMTP, it is lost since the From: header is used there.
This patch fixes that, in that it will prefer the Return-Path header as the envelope from. If it doesn't exist, From: is used.
The change is tiny.
Oddly, the unit tests I wrote to test this did NOT fail anyway. I suspect the TestMailer isn't actually behaving like a real one.
I would ask this patch to be included in the upcoming rails release.