Postfix unable to send mail to Gmail
In the comments you say it's an AWS EC2 instance. AWS restricts outbound SMTP by default. The internal firewall rules on your instance doesn't help with that, but you have to request for a removal.
How do I remove the restriction on port 25 from my EC2 instance?
Resolution
Amazon EC2 restricts outbound traffic on port 25 of all EC2 instances by default. You can request the removal of this restriction.
- Sign in with your AWS account, and then open the Request to remove email sending limitations form.
You'd also need...
A clear and detailed use case for sending email from your EC2 instance.
Learning how to host a mail server isn't necessarily a reason good enough for them. Securing the mail server properly so that you won't end up being used as a relay for spam is hard business.