The URL link in email Welcome Registration is not updated

When you change the nginx port of the server, the welcome email and password reset will fail because the URL embedded in the email body does not contain the port,I see it’s quite old already, hope someone can take a look at it and fix it.

After update ther erpnext to v14 it is shown some emails have error and stay in email queue as

I see it’s quite old already, hope someone can take a look at it and fix it.