Mailx not sending mail and showing "Network is unreachable"

HI ,
I installed mailx in Centos and trying to send mails but not going.
Below steps done:
yum install mailx
mailx -s ‘test’ abc@gmail.com

Below logs in maillog:
status=deferred (connect to alt2.gmail-smtp-in.l.google.com:25: Network is unreachable)

Please suggest where i am getting wrong

@dvrkittu

Try this command

echo “your msg” | mailx -s “subject” yourname@gmail.com

What’s the output of these commands:

ping google.com cat /etc/resolv.conf

Hi ,

I tried echo “your msg” | mailx -s “subject” yourname@gmail.com ,still same issue.
output is:

Jan 19 11:21:42 mq1 postfix/smtp[38264]: 02B7E837B5: to=abc@gmail.com, relay=none, delay=60, delays=0.05/0.01/60/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[74.125.133.109]:587: Connection timed out)

I also tried ping google.com and output is “PING google.com (216.58.208.78) 56(84) bytes of data” and it got stuck there.

Please help me

Execute these:

mv /etc/resolv.conf /etc/resolv.conf.bak
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
service network restart

Then try again.

Edit: Modified because of a mistake.

1 Like