SMTPUnknownError encountered when sending with QQ Mail

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Emails are successfully sent through QQ Mail, but the gitlab-rails component treats the delivery as a failure, resulting in the same email being sent 3–4 times.

This issue occurs in a GitLab instance running inside Docker Compose.

Here is the relevant Docker Compose configuration (sensitive info redacted):

version: "3.7"
services:
   web:
     image: "gitlab/gitlab-ce:latest"
     restart: always
     container_name: gitlab-ce
     environment:
       GITLAB_OMNIBUS_CONFIG: |
         external_url 'https://gitlab.com'
         nginx['redirect_http_to_https'] = true
         letsencrypt['enable'] = false
         gitlab_rails['gitlab_ssh_host'] = 'gitlab.com'
         gitlab_rails['gitlab_shell_ssh_port'] = 22
         gitlab_rails['smtp_enable'] = true
         gitlab_rails['smtp_address'] = "smtp.qq.com"
         gitlab_rails['smtp_port'] = 465
         gitlab_rails['smtp_user_name'] = "xxxxxx@foxmail.com"
         gitlab_rails['smtp_password'] = "adfxxxxxxxxxxawe"
         gitlab_rails['smtp_authentication'] = "login"
         gitlab_rails['smtp_enable_starttls_auto'] = false
         gitlab_rails['smtp_tls'] = true
         gitlab_rails['gitlab_email_from'] = 'xxxxx@foxmail.com'
         gitlab_rails['gitlab_email_display_name'] = 'GitLab title'
         gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'
     ports:
       - "22:22"
       - "80:80"
       - "443:443"
     volumes:
       - "./config/web/config:/etc/gitlab"
       - "./config/web/logs:/var/log/gitlab"
       - "./config/web/data:/var/opt/gitlab"
     networks:
       - gitlab
   gitlab-runner:
     image: gitlab/gitlab-runner:alpine
     container_name: gitlab-runner
     restart: always
     depends_on:
       - web
     privileged: true
     volumes:
       - "./config/runner/docker.sock:/var/run/docker.sock"
       - "./config/runner/gitlab-runner:/etc/gitlab-runner"
     networks:
       - gitlab

networks:
   gitlab:
     name: gitlab-network

The following error was encountered when sending a test email via Rails console:

irb(main):001:0> Notify.test_email('xxxxxx@qq.com', 'title', 'body').deliver_now
Delivered mail 67fdac27a7250_4e730ac807c4@dfad5ceeaf51.mail (999.4ms)
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1076:in `check_response': ␦ (Net::SMTPUnknownError)
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1044:in `getok'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1026:in `quit'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:715:in `do_finish'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:614:in `start'
        from /opt/gitlab/embedded/service/gitlab-rails/config/initializers/mail_starttls_patch.rb:53:in `start_smtp_session'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:2145:in `do_delivery'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:253:in `block in deliver'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionmailer-7.0.8.7/lib/action_mailer/base.rb:588:in `block in deliver_mail'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in `block in instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activesupport-7.0.8.7/lib/active_support/notifications.rb:206:in `instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionmailer-7.0.8.7/lib/action_mailer/base.rb:586:in `deliver_mail'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:253:in `deliver'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionmailer-7.0.8.7/lib/action_mailer/message_delivery.rb:119:in `block in deliver_now'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/actionmailer-7.0.8.7/lib/action_mailer/rescuable.rb:19:in `handle_exceptions'
        ... 14 levels...
Edited by 🤖 GitLab Bot 🤖