Service Desk - add support for X-Envelope-To header
Summary
The Service Desk currently looks for the Envelope-To
header when processing mail and it doesn't look for the X-Envelope-To
header. On email systems that only use X-Envelope-To
headers, it prevents the Service Desk from working at all.
An Ultimate customer with 30 seats has contacted us with this request - ZD (internal use only)
We would like to use the Gitlab Service Desk Feature. For that we created a new mail address on our mail server, that redirects all incoming mails to an external imap server that is configured in Gitlab. Unfortunately all mails to that address are rejected by Gitlab (
Error Message: “Unfortunately, your email message to GitLab could not be processed“.
) The problem is that Gitlab can not find the service desk address (e.g.gitlab+myproject-@incoming.foo.bar
) in the header information of the redirected mail. Our mail provider (Microsoft) includes this information in anX-Envelope-To
header, which is currently not supported by Gitlab.
Since I can't see a workaround, I have given it the ~bug and ~S2 labels - I'm not sure if I've classified it correctly so please feel free to change this.
Steps to reproduce
- Use an email system that only supports the
X-Envelope-To
header - Setup incoming mail and service desk
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version)
What is the current bug behavior?
Incoming service desk mail that uses X-Envelope-To
headers are ignored, and results in a Error Message: “Unfortunately, your email message to GitLab could not be processed“.
error.
What is the expected correct behavior?
Incoming service desk mail that uses X-Envelope-To
headers should be used if the key could not be found in other headers, and route the message accordingly.
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
This function https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/email/receiver.rb#L87-92 is responsible for the Envelope-To
header, we should either modify it or add a new function for X-Envelope-To
support.