If you are trying to run things on a VPS, many hosting companies will block the standard email ports by default to prevent spammers from using their network. Usually you have to go through some extra steps to open up those ports.
Some smtp services will allow you to use a nonstandard port. I use resend.com to send smtp emails, and this is what my PieFed environment variables look like:
MAIL_USE_TLS=True
MAIL_SERVER='smtp.resend.com'
MAIL_PORT=2587
MAIL_USERNAME='resend'
MAIL_PASSWORD='my_api_key'
MAIL_FROM='my_from_email@instance.tld'