gitlab register can not receiver email confirmation

http://10.18.1.2:9999/develop/5GC/wikis/home#getting-started

1. deploy gitlab in docker
https://jingyan.baidu.com/article/3a2f7c2ed314ef26afd611a1.html

sudo docker run --detach --hostname 192.168.43.89 --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab --restart always
-v /home/ubuntu/gitlab/config:/etc/gitlab
-v /home/ubuntu/gitlab/logs:/var/log/gitlab
-v /home/ubuntu/gitlab/data:/var/opt/gitlab
gitlab/gitlab-ee:10.7.3-ee.0

2. into the gitlab container
docker exec -it gitlab /bin/bash

3. use ruby console
gitlab-rails console
Notify.test_email('welcomeyangpeng@163.com', 'Message Subject', 'Message Body').deliver_now
look for the error
root@192:/# gitlab-rails console
Notify.test_email('welcomeyangpeng@163.com', 'Message Subject', 'Message Body').deliver_now

Loading production environment (Rails 4.2.10)
irb(main):001:0> Notify.test_email('welcomeyangpeng@163.com', 'Message Subject', 'Message Body').deliver_now

Notify#test_email: processed outbound mail in 192.4ms
sh: 1: /usr/sbin/sendmail: not found

Sent mail to welcomeyangpeng@163.com (12.4ms)
Date: Mon, 19 Oct 2020 14:15:11 +0000
From: GitLab <gitlab@192.168.43.89>
Reply-To: GitLab <noreply@192.168.43.89>
To: welcomeyangpeng@163.com
Message-ID: <5f8d9f6fe4666_4c23fc83a2c70d0536e0@192.168.1.5.mail>
Subject: Message Subject
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>Message Body</p></body></html>

=> #<Mail::Message:70129009014320, Multipart: false, Headers: <Date: Mon, 19 Oct 2020 14:15:11 +0000>, <From: GitLab <gitlab@192.168.43.89>>, <Reply-To: GitLab <noreply@192.168.43.89>>, <To: welcomeyangpeng@163.com>, <Message-ID: <5f8d9f6fe4666_4c23fc83a2c70d0536e0@192.168.1.5.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
### GitLab email server settings
###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
###! **Use smtp instead of sendmail/postfix.**

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "490195356@qq.com"
gitlab_rails['smtp_password'] = "tprhxxigfjntbhbf"
gitlab_rails['smtp_domain'] = "smtp.qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = "490195356@qq.com"

 4. apt update and apt install sendmail , then try the ruby command again

irb(main):003:0* Notify.test_email('490195356@qq.com', 'Message Subject', 'Message Body').deliver_now

Notify#test_email: processed outbound mail in 2.4ms

Sent mail to 490195356@qq.com (912.8ms)
Date: Mon, 19 Oct 2020 14:31:28 +0000
From: GitLab <gitlab@192.168.43.89>
Reply-To: GitLab <noreply@192.168.43.89>
To: 490195356@qq.com
Message-ID: <5f8da34023a9e_11b93f825ecc70e877be@192.168.1.5.mail>
Subject: Message Subject
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>Message Body</p></body></html>

=> #<Mail::Message:69828782575500, Multipart: false, Headers: <Date: Mon, 19 Oct 2020 14:31:28 +0000>, <From: GitLab <gitlab@192.168.43.89>>, <Reply-To: GitLab <noreply@192.168.43.89>>, <To: 490195356@qq.com>, <Message-ID: <5f8da34023a9e_11b93f825ecc70e877be@192.168.1.5.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
docker commit -a "peng.yang" -m "v1" gitlab gitlab/gitlab-ee:10.7.3-ee.0.v1
hints: if change some config, remember to restart gitlab.
原文地址:https://www.cnblogs.com/cjyp/p/13843882.html