Email configuration error

I was trying to setup my gmail account into the server. But email is not getting configured.
The error message is Invalid Outgoing Mail Server or Port.
But I setup the same mail id and domain into my local server, the mail setup is working properly.
In local
ErpNext version: 12.0.3
Frappe version: 12.0.3
In global
ErpNext version: v12.x.x-develop () (develop)
Frappe version: v12.x.x-develop () (develop)
There is a difference in domain page. The web one has one extra field port