Return-Path in Rails ActionMailer

So today I finally made Rails do something I needed for a long time: honour the Return-Path header on outgoing emails. This is basically the return address for MTAs, er, computers to use. It’s a quite useful header since you can manage your mailing list the proper way. I.e. have replies sent to you, but quota warnings and delivery faillures sent to a computer.

Rails would honor the Return-Path header, but then pass it off to Net::SMTP where it got lost.

I feared this would be a tough one to crack but the solution was tiny. It just took me a couple hours to figure it out, browsing the net/smtp.rb source.

I submitted the patch to the Rails repository just now and I expect it will be added to trunk (or as the Rails people say: “edge”). Should become available soon.