I don't know about Production. can you tell me why Production doesn't care about ports? 

while responding can you address what I see are the aspects which need separate treatment: 
- how do Mailers infer the appropriate host+port  (as there is no action from which `url_for` might determine host and port)
- when called in a Controller, why does port not matter ... are you 100% confident url_for will get the host and port correct?
- when called in e.g. PayPalCheckout what should the host and port be and where should determined from?