I want the server able to send mail via gmail smtp. The installation of msmtp was successful. I able to send using msmtp via the command line. However, when I try to send via php, it got me this error.

postfix/smtp[11241]: connect to gmail-smtp-in.l.google.com[]:25: Connection timed out

postfix/smtp[11241]: connect to gmail-smtp-in.l.google.com[2404:6800:4003:c00::1b]:25: Network is unreachable connect to alt2.gmail-smtp-in.l.google.com[]:25: Connection timed out

postfix/smtp[11241]: 8F4DB10D10: to=, relay=none, delay=1086, delays=993/0.13/93/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[]:25: Connection timed out)

I had change the postfix config file

inet_interfaces = localhost


inet_interfaces = all

But still no avail

Any idea why?

By the way, I am using Centos with LEMP stack.


If you are sending email from gmail, meaning your gmail account & clearly using postfix you'll need sasl auth and use Google's smtp connection on port 587... Postfix-Gmail guide


I found the problem, turn out is the msmtp config file permission issue. I change it to the proper user and group, and it works now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.