Port on outgoing mail server config freezes

So I installed ERPNExt on Ubuntu on an Amazon EC2 server. Gave no issues using the easy install off github. I created my Admin user and tried to confgure outgoing mails so I can create additional users. I configured the outgoing mails server and clicked saved, at this point it just froze and would not save.

After playing around and trying different methods I found it is when I maintained the port value that it froze. All other fields saved fine. Would this be something on ERPNext, Frappe or maybe on the Amazon EC2 with conflicting ports or something. But I thought this port number told ERPNext which port to connect to on the mail server which is not on Amazon so this should not be on the amazon side.

Any clue, I left the port blank and my mails go out find but I would like a solution for one day when I do need to maintain the port.

Did you check the firewall settings (both on the ec2 instance and security groups)?