Postfix + gmail: greeted me with my own hostname localhost

My emails for my domain name is hosted by gmail and I have set the mx records to google’s in my domain host. So my emails were working perfectly.

But after I have my domain name (nameservers) pointed to a cloud server in which I use Postfix for sending mails, my emails stopped working – I can’t receive. Only can send out. This is my Postfix config:

// /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_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
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 = ipv4

But when I tried to send emails to my email accounts, e.g. lau@something.com:

echo "This is a test email body." | mail -s "Subject" -a "From: something.lau@gmail.com" lau@something.com

I get an error in the log, for example:

Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: warning: host something.com[xxx.xxx.xxx.xxx]:25 greeted me with my own hostname localhost
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: warning: host something.com[xxx.xxx.xxx.xxx]:25 replied to HELO/EHLO with my own hostname localhost
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: E8A82C1963: to=<lau@something.com>, relay=something.com[xxx.xxx.xxx.xxx]:25, delay=0.07, delays=0.02/0.02/0.03/0, dsn=5.4.6, status=bounced (mail for something.com loops back to myself)
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtpd[62919]: disconnect from unknown[xxx.xxx.xxx.xxx] ehlo=1 quit=1 commands=2
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/cleanup[62933]: 03507C1964: message-id=<20201126112627.03507C1964@localhost>
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/bounce[62935]: E8A82C1963: sender non-delivery notification: 03507C1964
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/qmgr[62878]: 03507C1964: from=<>, size=2207, nrcpt=1 (queue active)
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/qmgr[62878]: E8A82C1963: removed
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: 03507C1964: to=<something.lau@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.206.26]:25, delay=0.82, delays=0/0/0.13/0.68, dsn=2.0.0, status=sent (250 2.0.0 OK  1606389987 a7si5380005wmf.125 - gsmtp)
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/qmgr[62878]: 03507C1964: removed

I have set an SPF record at my domain host already, for example:

v=spf1 ip4:xxx.xxx.xxx.xxx include:_spf.google.com ~all 

This works before the nameservers for my domain name was fully propagated. But now it just stopped working.

What else have I missed?

Answer

Attribution
Source : Link , Question Author : Run , Answer Author : Community

Leave a Comment