"gitlab_email_from" setting not used by gitlab generated emails

Summary

Emails sent by the notifications system or password reset link does not use the "gitlab_email_from" setting. It sends email from the actual gitlab domain.

Steps to reproduce

Go through the password reset process. Received email will not be from the "gitlab_email_from" address.

Do any actions to receive a notification email and it will not be from the "gitlab_email_from" address.

What is the current bug behavior?

Email is sent from the main gitlab domain.

What is the expected correct behavior?

Email should be using the "gitlab_email_from" setting.

Relevant logs and/or screenshots

Example: Gitlab domain is gitlab.domain.com

gitlab.rb contains gitlab_rails['gitlab_email_from'] = 'gitlab@email.domain.com'

Email sent will be from "gitlab.domain.com" and not "email.domain.com"

When testing through the gitlab rails console to send an email, the proper domain is used (email.domain.com): Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now

Configuration (gitlab.rb)

gitlab_rails['smtp_address'] = "smtp.sparkpostmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "SMTP_Injection"
gitlab_rails['smtp_password'] = "1234" # https://app.sparkpost.com/account/credentials
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = 'gitlab@email.domain.com'
gitlab_rails['gitlab_email_reply_to'] = 'admin@domain.com'```

#### Results of GitLab environment info

<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>

System information
System:         Ubuntu 16.04
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.3.6p384
Gem Version:    2.6.13
Bundler Version:1.13.7
Rake Version:   12.3.0
Redis Version:  3.2.11
Git Version:    2.14.3
Sidekiq Version:5.0.5
Go Version:     unknown

GitLab information
Version:        10.5.4-ee
Revision:       18e79be
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
DB Version:     9.6.5
URL:            https://gitlab.domain.com
HTTP Clone URL: https://gitlab.domain.com/some-group/some-project.git
SSH Clone URL:  git@gitlab.domain.com:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        6.0.3
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git

</pre>
</details>

#### Results of GitLab application Check

<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>

Checking GitLab Shell ...

GitLab Shell version >= 6.0.3 ? ... OK (6.0.3)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
1/1 ... repository is empty
1/26 ... ok
1/27 ... ok
1/28 ... ok
1/29 ... ok
1/30 ... ok
1/31 ... ok
1/32 ... ok
1/33 ... ok
1/34 ... ok
1/35 ... ok
1/36 ... ok
1/37 ... ok
1/38 ... ok
1/39 ... ok
1/40 ... ok
1/41 ... ok
1/42 ... ok
1/43 ... ok
1/44 ... ok
1/45 ... ok
1/46 ... ok
1/47 ... ok
1/48 ... ok
1/49 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml
Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet)
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ... 
1/1 ... yes
1/26 ... yes
1/27 ... yes
1/28 ... yes
1/29 ... yes
1/30 ... yes
1/31 ... yes
1/32 ... yes
1/33 ... yes
1/34 ... yes
1/35 ... yes
1/36 ... yes
1/37 ... yes
1/38 ... yes
1/39 ... yes
1/40 ... yes
1/41 ... yes
1/42 ... yes
1/43 ... yes
1/44 ... yes
1/45 ... yes
1/46 ... yes
1/47 ... yes
1/48 ... yes
1/49 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.3.6)
Git version >= 2.9.5 ? ... yes (2.14.3)
Git user has default SSH configuration? ... yes
Active users: ... 1
Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)

Checking GitLab ... Finished

</pre>
</details>

### Possible fixes

I don't know where the problem can be found in the code.
Edited Mar 12, 2018 by Stefan
Assignee Loading
Time tracking Loading