Email problem with the latest version of gitlab installation

creating a new user cannot send mail when installing the gitlab repository.

postfix has been installed

[root@VM_0_14_centos ~]-sharp systemctl status postfix
 postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-10-28 16:08:25 CST; 1h 9min ago
  Process: 11426 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
  Process: 16354 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 16352 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 16348 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 16428 (master)
   CGroup: /system.slice/postfix.service
           16428 /usr/libexec/postfix/master -w
           16429 pickup -l -t unix -u
           16430 qmgr -l -t unix -u

/ configuration under etc/gitlab/gitlab.rb

gitlab_rails["gitlab_email_enabled"] = true
gitlab_rails["gitlab_email_from"] = "XX@163.com"
gitlab_rails["gitlab_email_display_name"] = "Admin"
gitlab_rails["gitlab_email_reply_to"] = "XX@163.com"
gitlab_rails["gitlab_email_subject_suffix"] = "[gitlab]"
gitlab_rails["smtp_enable"] = true
gitlab_rails["smtp_address"] = "smtp.163.com"
gitlab_rails["smtp_port"] = 25
gitlab_rails["smtp_user_name"] = "XX@163.com"
gitlab_rails["smtp_password"] = "XX"
gitlab_rails["smtp_domain"] = "163.com"
gitlab_rails["smtp_authentication"] = "login"
gitlab_rails["smtp_enable_starttls_auto"] = true
gitlab_rails["smtp_tls"] = false
user["git_user_email"] = "XX@163.com"

Test the error prompt for sending mail:

Net::OpenTimeout: execution expired
    from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `initialize"
    from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `open"
    from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `tcp_socket"
    from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:549:in `block in do_start"
    from /opt/gitlab/embedded/lib/ruby/2.4.0/timeout.rb:103:in `timeout"
    from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:548:in `do_start"
    from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:518:in `start"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:2160:in `do_delivery"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:260:in `block in deliver"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_mailer/base.rb:543:in `block in deliver_mail"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in `block in instrument"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in `instrument"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_mailer/base.rb:541:in `deliver_mail"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:260:in `deliver"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_mailer/message_delivery.rb:85:in `deliver_now"
    from (irb):1
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/console.rb:110:in `start"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/console.rb:9:in `start"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:68:in `console"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands/commands_tasks.rb:39:in `run_command!"
    from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/commands.rb:17:in `<top (required)>"
    from bin/rails:14:in `require"
    from bin/rails:14:in `<main>"

Firewall and security policy have opened port 25

Oct 28 21:07:46 VM_0_14_centos postfix/smtp[29415]: connect to 163mx01.mxmail.netease.com[220.181.14.141]:25: Connection timed out
Oct 28 21:08:16 VM_0_14_centos postfix/smtp[29415]: connect to 163mx02.mxmail.netease.com[220.181.14.155]:25: Connection timed out
Oct 28 21:08:46 VM_0_14_centos postfix/smtp[29415]: connect to 163mx03.mxmail.netease.com[220.181.14.163]:25: Connection timed out
Oct 28 21:09:16 VM_0_14_centos postfix/smtp[29415]: connect to 163mx02.mxmail.netease.com[220.181.14.154]:25: Connection timed out
Oct 28 21:09:46 VM_0_14_centos postfix/smtp[29415]: connect to 163mx03.mxmail.netease.com[220.181.14.156]:25: Connection timed out

ask for answers from all kinds of gods.

Feb.24,2022

problems with mail configuration.
is basically caused by a mismatch between configuring the port and whether or not to use the ssl configuration.
1 uses port 25, so do not configure ssl related items

gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = false

2 use 465 (or others), you should set the following

gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'none'

Menu