Skip to content

Add Service Desk custom email foundation

What does this MR do and why?

Right now it is not possible to customize the Service Desk email address (intake and sending) in its entirety. On self-hosted instances you have more control over the used addresses, but you will still have a rather cryptic target email address for a specific service desk in a project. For .com users it's currently not possible to customize the Service Desk email at all.

There is a proposal and a further exploration around this issue. A summary of the solution path is the following: Users set up their custom email to forward all emails to the cryptic Service Desk email and provide SMTP credentials so we can send emails on their behalf. This way customers seeking support will only see the custom email address in their communication.

There is further discussion about improving and changing the general infrastructure, but this approach is a MVC to solve the issue for our customers.

This is the first MR for Configurable e-mail address for service desk (#329990 - closed) and lays out the foundation for the feature:

  1. Adds database fields to service_desk_settings so we can save the custom_email, whether it is enabled and the corresponding custom_email_smtp_* credentials. custom_email_smtp_password is an encrypted attribute, so it has two fields.
  2. Adds the Feature flag service_desk_custom_email. Also see [Feature flag] Rollout of `service_desk_custom_... (#387003 - closed)
  3. Overrides the default delivery method for all Service Desk emails (thank_you and new_note) when the FF is enabled and service_desk_setting.custom_email_enabled?. It then uses Mail::SMTP delivery method with the provided custom email smtp credentials.

This MR is the first part in a series of MRs that will follow in order to complete this feature. See #329990 (comment 1227384943) for a detailed breakdown. Here's a summary:

  1. 🎯 Using SMTP credentials. Foundation work.
  2. Verify email ownership, correct function and setup
  3. Ingest replies from custom email
  4. Add settings and validation to Settings page
  5. Add documentation

Screenshots or screen recordings

Only BE changes in this MR.

How to set up and validate locally

  1. Go to your projects settings (e.g. in FlightJs/Flight) and enable Service Desk and provide a Email display name and save the changes. This way you ensure you have a Service Desk setting in your database. You can also add it manually via the console.
  2. Open the console and add some email SMTP credentials like this (you need to provide correct SMTP settings to see an email popup somewhere)
s = ServiceDeskSetting.last
s.custom_email = "support@example.com"
s.custom_email_enabled = true
s.custom_email_smtp_username = "support@example.com"
s.custom_email_smtp_address = "smtp.example.com"
s.custom_email_smtp_port = 587
s.custom_email_smtp_password = "superpassword"
s.save!
  1. Add a Service Desk issue
  2. Add a note to the issue
  3. You should see the generated email in LetterOpener as the FF is off
  4. Enable the FF globally or for your project only in the console Feature.enable(:service_desk_custom_email)
  5. Add a note to the issue
  6. You should receive a new email to Service Desk issue external authors inbox sent via the provided SMTP credentials (assuming these are valid)
  7. Disable the custom email via s.custom_email_enabled = true; s.save!
  8. Add a new note to the issue
  9. You should see the generated email in LetterOpener as it's disabled but the FF is on

SMTP credentials validation and verification will be handled in an upcoming MR.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marc Saleiko

Merge request reports