How will Mail handle an SMTP server port number change?

There might be two things that you have to do:

It should work automatically without any intervention after the port upgrade. But to make it smooth, you might need to re-add your account in Apple Mail.

You can manually modify and add specified port too but it depends upon your email provider. However, in most cases, it should go automatically.