Why do settings disappear? Mail, usuallly
Here is the explanation from my provider's tech support:


  We think you should turn off [automatically manage connection
  settings]; there should never be any reason for it to use different
  ones. You always want it to stick with the recommended port 587
  (etc.), no matter what.
  
  The trouble with that feature is that if your ISP connection stops
  working for a second, and Apple Mail can't connect, it will think "oh,
  the settings might be wrong, so let's try a different port". It tries
  something else at random, and maybe it works, because your ISP
  connection is working again. But Apple Mail wrongly assumes the port
  setting was the trouble -- so it saves the new setting! And then
  you're using something weird that only works on certain networks,
  etc., when it would have been better to keep the original "works
  everywhere" port number.
  
  Apple Mail is the only program we know of that does anything like
  this, and it's not a good idea, really; it's designed to help people
  if their mail server company changes things, but can cause problems in
  other cases. We've even seen cases where it randomly changes the
  settings to something that can never possibly work on any servers,
  although it's not supposed to.


As evidence for this explanation, when I turned it off and it revealed the port settings, they were different for each account (but all were wrong).