Allow to fetch incoming emails from multiple addresses
Problem to solve
This is prerequisite for #2201 (closed).
By default we use single email address for all incoming emails (configured in config/gilab.yml's incoming_email
section) and has format incoming+%{key}@gitlab.com
. And types of emails (e.g. comments, new issues, service desk issues) are identified depending on the key pattern.
The problem is that for service desk emails this address with the key is quite long and not easily readable - it looks like this: incoming+<group>-<project>-<project id>-issue-@gitlab.com
and it would be nice to use simpler and configurable address for it.
Proposal
Add a separate configurable service desk email section into config/gitlab.yml which would allow to customize service desk email address pattern similar to incoming_email
section we already have:
service_desk_email:
enabled: true
# The email address including the `%{key}` placeholder that will be replaced to reference the item being replied to.
# The placeholder can be omitted but if present, it must appear in the "user" part of the address (before the `@`).
address: "support+%{key}@gmail.com"
# Email account username
# With third party providers, this is usually the full email address.
# With self-hosted email servers, this is usually the user part of the email address.
user: "user@gmail.com"
# Email account password
password: "password"
# IMAP server host
host: "imap.gmail.com"
# IMAP server port
port: 993
# Whether the IMAP server uses SSL
ssl: true
# Whether the IMAP server uses StartTLS
start_tls: false
Our mail_room's configuration will be configured to fetch emails from both incoming_email
and service_desk_email
(if these are enabled - by default service_desk_email will be disabled).
Emails delivered to service_desk_email
will be enqueued in a separate service desk queue/worker (not the default app/workers/email_receiver_worker.rb
) and this service desk worker will process key
part of the email (this could be perhaps project's full path name? support+gitlab-org/gitlab@gitlab.com
, it will extract project from the part after +
- same as we do for other incoming emails, the difference is that we don't need too complicated pattern after +
because we already know this is a service desk email based the separate address before +
- support+...@gitlab.com
. The pattern of the key will be project_slug-configurable_name
- for example for gitlab
project it would be gitlab-org-gitlab-configurable_name
.
Then in the next step - #2201 (closed) - we can make the +{key}
configurable.
We will probably have to update also omnibus configuration to pre-generate this new config section in gitlab.yml. And also update gdk with this default config.