0

This question already has an answer here:

I have Ubuntu 18.04.2 LTS installed on Vmware, inside Windows.

Using terminal, I'm trying to send a test e-mail using this command:

echo "Test Email message body" | mail -s "Email test subject" my_email@gmail.com

However the /var/log/mail.log shows:

connect to gmail-smtp-in.l.google.com[64.233.190.27]:25: Connection refused

and

connect to gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1b]:25: Network is unreachable

Here the full log:

May 13 16:50:59 ubuntu postfix/postfix-script[1250]: starting the
Postfix mail system May 13 16:50:59 ubuntu postfix/master[1257]:
daemon started -- version 3.3.0, configuration /etc/postfix May 13
16:50:59 ubuntu postfix/qmgr[1260]: B69EE868E2: from=<root@ubuntu>,
size=363, nrcpt=1 (queue active) May 13 16:50:59 ubuntu
postfix/qmgr[1260]: C56A4857C2: from=<root@ubuntu>, size=364, nrcpt=1
(queue active) May 13 16:51:20 ubuntu postfix/smtp[1263]: connect to
gmail-smtp-in.l.google.com[64.233.190.27]:25: Connection refused May
13 16:51:20 ubuntu postfix/smtp[1264]: connect to
gmail-smtp-in.l.google.com[64.233.190.27]:25: Connection refused May
13 16:51:20 ubuntu postfix/smtp[1264]: connect to
gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1b]:25: Network is
unreachable May 13 16:51:20 ubuntu postfix/smtp[1263]: connect to
gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1b]:25: Network is
unreachable May 13 16:51:34 ubuntu postfix/pickup[1259]: 9A493868DB:
uid=0 from=<root@ubuntu> May 13 16:51:34 ubuntu postfix/cleanup[1856]:
9A493868DB: message-id=<20190513195134.9A493868DB@anydomain.com.br>
May 13 16:51:34 ubuntu postfix/qmgr[1260]: 9A493868DB:
from=<root@ubuntu>, size=362, nrcpt=1 (queue active) May 13 16:51:35
ubuntu postfix/smtp[1857]: connect to
gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1a]:25: Network is
unreachable May 13 16:51:42 ubuntu postfix/smtp[1263]: connect to
alt1.gmail-smtp-in.l.google.com[66.102.1.26]:25: Connection refused
May 13 16:51:42 ubuntu postfix/smtp[1263]: connect to
alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1a]:25: Network is
unreachable May 13 16:51:42 ubuntu postfix/smtp[1264]: connect to
alt1.gmail-smtp-in.l.google.com[66.102.1.26]:25: Connection refused
May 13 16:51:42 ubuntu postfix/smtp[1264]: connect to
alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1a]:25: Network is
unreachable May 13 16:51:56 ubuntu postfix/smtp[1857]: connect to
gmail-smtp-in.l.google.com[64.233.190.26]:25: Connection refused May
13 16:51:56 ubuntu postfix/smtp[1857]: connect to
alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1a]:25: Network is
unreachable May 13 16:52:03 ubuntu postfix/smtp[1264]: connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused
May 13 16:52:03 ubuntu postfix/smtp[1263]: connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused
May 13 16:52:03 ubuntu postfix/smtp[1263]: B69EE868E2:
to=<my_email@gmail.com>, relay=none, delay=95, delays=31/0.03/64/0,
dsn=4.4.1, status=deferred (connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused)
May 13 16:52:03 ubuntu postfix/smtp[1264]: C56A4857C2:
to=<my_email@gmail.com>, relay=none, delay=448, delays=384/0.02/64/0,
dsn=4.4.1, status=deferred (connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused)
May 13 16:52:17 ubuntu postfix/smtp[1857]: connect to
alt1.gmail-smtp-in.l.google.com[66.102.1.27]:25: Connection refused
May 13 16:52:17 ubuntu postfix/smtp[1857]: connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable May 13 16:52:17 ubuntu postfix/smtp[1857]: 9A493868DB:
to=<my_email@gmail.com>, relay=none, delay=43, delays=0.03/0.01/43/0,
dsn=4.4.1, status=deferred (connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable) May 13 16:55:59 ubuntu postfix/qmgr[1260]: EA29D868DD:
from=<root@ubuntu>, size=363, nrcpt=1 (queue active) May 13 16:55:59
ubuntu postfix/qmgr[1260]: 768FA868E1: from=<root@ubuntu>, size=363,
nrcpt=1 (queue active) May 13 16:55:59 ubuntu postfix/error[2044]:
768FA868E1: to=<my_email@gmail.com>, relay=none, delay=370,
delays=370/0.01/0/0.01, dsn=4.4.1, status=deferred (delivery
temporarily suspended: connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable) May 13 16:55:59 ubuntu postfix/error[2043]: EA29D868DD:
to=<my_email@gmail.com>, relay=none, delay=520,
delays=520/0.03/0/0.02, dsn=4.4.1, status=deferred (delivery
temporarily suspended: connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable)

What is wrong?


Edit

Here the content of /etc/postfix/main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = rogeriodec.com.br
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, ubuntu, localhost.localdomain, , localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all

marked as duplicate by Jim, user535733, Eric Carvalho, Fabby, Thomas May 19 at 13:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Please post content of /etc/postfix/main.cf. – Jim May 14 at 1:06
  • @Jim, inserted in the original post. – Rogério Dec May 14 at 1:54
  • Do you achieve to send mail through postfix using gmail ? – Jim May 14 at 2:03
  • I don't know Ubuntu. I have just a Wordpress site inside my Vmware and there the emails are not being sent. So I did the "echo" test above. If you could help me with more information... – Rogério Dec May 14 at 2:24