email server – Postfix relay to gmail ‘too many hops’

I have two domains configured on one mail Postfix server (Dovecot) : sampleA.com that is the primary domain, and sampleB.com.

For sampleB.com it managed by 2 mails servers :

  • my local linux postfix server
  • gmail pro (for certains users)

I’ve configured my Postfix server to redirect to gmail when recipient match in transport_maps.
My main.cf :

alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 1
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = $mydomain, localhost.$mydomain, localhost
myhostname = hostname.sampleA.com
mynetworks = 127.0.0.0/8 (::ffff:127.0.0.0)/104 (::1)/128
myorigin = /etc/mailname
non_smtpd_milters = inet:localhost:12301 inet:localhost:54321
readme_directory = no
recipient_delimiter = +
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = reject_non_fqdn_helo_hostname,reject_invalid_helo_hostname,reject_unknown_helo_hostname
smtpd_milters = inet:localhost:12301 inet:localhost:54321
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/letsencrypt/live/sampleA.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/sampleA.com/privkey.pem
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = dovecot

My /etc/postfix/transport content :

john@sampleB.com smtp:(smtp.gmail.com):587
sampleB.com local
sampleA.com local

For my tests I’ve created a virtual alias doe@sampleB.com (so managed by my local Postfix server).
When I send a mail to doe@sampleB.com, it’s work, I’ve receive my mail without any problem.

When I send a mail to john@sampleB.com, mail is delivery to gmail account (fine), but a loop appear : mail is sent from doe@sampleB.com to doe@sampleB.com until ‘554 5.4.0 Error: too many hops’ error.

The first part of log before loop : https://pastebin.com/PNXYGtTX

Any idea ?