2

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[74.125.200.27]: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[74.125.25.26]: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[74.125.25.26]:25: Connection timed out)

I had change the postfix config file

inet_interfaces = localhost

to

inet_interfaces = all

But still no avail

Any idea why?

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

dev-jim
  • 283
  • 1
  • 2
  • 8

2 Answers2

1

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.

dev-jim
  • 283
  • 1
  • 2
  • 8
0

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

Jacob Evans
  • 7,636
  • 3
  • 25
  • 55