Issues with sending mail via Gmail relay

I have recently installed Gitlab on a brand new Raspberry Pi 3. I am running Raspbian lite with ONLY a Gitlab installation.

Gitlab version is 8.17.4-ce.0.

I have setup postfix main.cf configuration like this:

smtpd_banner = $myhostname ESMTP $mail_name (Raspbian)
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 = some.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, some.domain.com, localhost.some.domain.com, localhost
relayhost = [smtp.gmail.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

# Enable SASL authentication
smtp_sasl_auth_enable = yes
# Disallow methods that allow anonymous authentication
smtp_sasl_security_options = noanonymous
# Location of sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
# Enable STARTTLS encryption
smtp_tls_security_level = encrypt
# Location of CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

I have tried running it with help from the debugging tips page: https://docs.gitlab.com/ce/administration/troubleshooting/debug.html and ran the following commands:

$ sudo gitlab-rails console production irb(main):003:0> Notify.test_email('sleeuwen1989@hotmail.com', 'Hello World', 'This is a test message').deliver_now

This works fine! I get an email via the Gmail relay. I can also see the email logging in /var/log/syslog:

Aug 30 21:47:37 gitlab postfix/pickup[828]: 97384A3582: uid=998 from=<gitlab@some.domain.com>
Aug 30 21:47:37 gitlab postfix/cleanup[2676]: 97384A3582: message-id=<59a7327980c33_6a53b3830f82614d@some.domain.com.mail>
Aug 30 21:47:37 gitlab postfix/qmgr[749]: 97384A3582: from=<gitlab@some.domain.com>, size=650, nrcpt=1 (queue active)
Aug 30 21:47:37 gitlab postfix/smtp[2683]: connect to smtp.gmail.com[2a00:1450:4013:c00::6d]:587: Network is unreachable
Aug 30 21:47:38 gitlab postfix/smtp[2683]: 97384A3582: to=<email@hotmail.com>, relay=smtp.gmail.com[108.177.119.108]:587, delay=1.4, delays=0.09/0.09/0.39/0.8, dsn=2.0.0, status=sent (250 2.0.0 OK 1504129658 l19sm2590575edc.32 - gsmtp)
Aug 30 21:47:38 gitlab postfix/qmgr[749]: 97384A3582: removed

It seems something is not working, but I do receive my test mail just fine.

--

However, when sending an email via the Gitlab portal for a lost password or by adding a new account, I receive no mail or any logging?

Any idea why Gitlab is not sending the emails and/or how I can figure out why this happens?

Assignee Loading
Time tracking Loading