Commit 086f871b authored by charlie ablett's avatar charlie ablett

Merge branch 'feat/add-expunge-option-mailroom' into 'master'

feat: add expunge deleted messages option to mailroom

See merge request gitlab-org/gitlab!31531
parents ab2b2108 4d7c4fe9
---
title: Add expunge deleted messages option to mailroom
merge_request: 31531
author: Diego Louzán
type: added
...@@ -202,6 +202,9 @@ production: &base ...@@ -202,6 +202,9 @@ production: &base
# #
# log_path: log/mail_room_json.log # log_path: log/mail_room_json.log
# Whether to expunge (permanently remove) messages from the mailbox when they are deleted after delivery
expunge_deleted: false
## Build Artifacts ## Build Artifacts
artifacts: artifacts:
enabled: true enabled: true
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
:name: <%= config[:mailbox].to_json %> :name: <%= config[:mailbox].to_json %>
:delete_after_delivery: true :delete_after_delivery: true
:expunge_deleted: <%= config[:expunge_deleted].to_json %>
:delivery_method: sidekiq :delivery_method: sidekiq
:delivery_options: :delivery_options:
......
...@@ -182,6 +182,9 @@ gitlab_rails['incoming_email_start_tls'] = false ...@@ -182,6 +182,9 @@ gitlab_rails['incoming_email_start_tls'] = false
gitlab_rails['incoming_email_mailbox_name'] = "inbox" gitlab_rails['incoming_email_mailbox_name'] = "inbox"
# The IDLE command timeout. # The IDLE command timeout.
gitlab_rails['incoming_email_idle_timeout'] = 60 gitlab_rails['incoming_email_idle_timeout'] = 60
# Whether to expunge (permanently remove) messages from the mailbox when they are deleted after delivery
gitlab_rails['incoming_email_expunge_deleted'] = true
``` ```
Example for source installs: Example for source installs:
...@@ -214,6 +217,9 @@ incoming_email: ...@@ -214,6 +217,9 @@ incoming_email:
mailbox: "inbox" mailbox: "inbox"
# The IDLE command timeout. # The IDLE command timeout.
idle_timeout: 60 idle_timeout: 60
# Whether to expunge (permanently remove) messages from the mailbox when they are deleted after delivery
expunge_deleted: true
``` ```
#### Gmail #### Gmail
...@@ -249,6 +255,9 @@ gitlab_rails['incoming_email_start_tls'] = false ...@@ -249,6 +255,9 @@ gitlab_rails['incoming_email_start_tls'] = false
gitlab_rails['incoming_email_mailbox_name'] = "inbox" gitlab_rails['incoming_email_mailbox_name'] = "inbox"
# The IDLE command timeout. # The IDLE command timeout.
gitlab_rails['incoming_email_idle_timeout'] = 60 gitlab_rails['incoming_email_idle_timeout'] = 60
# Whether to expunge (permanently remove) messages from the mailbox when they are deleted after delivery
gitlab_rails['incoming_email_expunge_deleted'] = true
``` ```
Example for source installs: Example for source installs:
...@@ -281,6 +290,9 @@ incoming_email: ...@@ -281,6 +290,9 @@ incoming_email:
mailbox: "inbox" mailbox: "inbox"
# The IDLE command timeout. # The IDLE command timeout.
idle_timeout: 60 idle_timeout: 60
# Whether to expunge (permanently remove) messages from the mailbox when they are deleted after delivery
expunge_deleted: true
``` ```
#### Microsoft Exchange Server #### Microsoft Exchange Server
......
...@@ -57,6 +57,9 @@ See the [Rails guides](https://guides.rubyonrails.org/action_mailer_basics.html# ...@@ -57,6 +57,9 @@ See the [Rails guides](https://guides.rubyonrails.org/action_mailer_basics.html#
mailbox: "inbox" mailbox: "inbox"
# The IDLE command timeout. # The IDLE command timeout.
idle_timeout: 60 idle_timeout: 60
# Whether to expunge (permanently remove) messages from the mailbox when they are deleted after delivery
expunge_deleted: false
``` ```
As mentioned, the part after `+` is ignored, and this will end up in the mailbox for `gitlab-incoming@gmail.com`. As mentioned, the part after `+` is ignored, and this will end up in the mailbox for `gitlab-incoming@gmail.com`.
......
...@@ -151,6 +151,7 @@ service_desk_email: ...@@ -151,6 +151,7 @@ service_desk_email:
log_path: "log/mailroom.log" log_path: "log/mailroom.log"
mailbox: "inbox" mailbox: "inbox"
idle_timeout: 60 idle_timeout: 60
expunge_deleted: true
``` ```
In this case, suppose the `mygroup/myproject` project Service Desk settings has the project name In this case, suppose the `mygroup/myproject` project Service Desk settings has the project name
......
...@@ -19,7 +19,8 @@ module Gitlab ...@@ -19,7 +19,8 @@ module Gitlab
start_tls: false, start_tls: false,
mailbox: 'inbox', mailbox: 'inbox',
idle_timeout: 60, idle_timeout: 60,
log_path: RAILS_ROOT_DIR.join('log', 'mail_room_json.log') log_path: RAILS_ROOT_DIR.join('log', 'mail_room_json.log'),
expunge_deleted: false
}.freeze }.freeze
# Email specific configuration which is merged with configuration # Email specific configuration which is merged with configuration
......
...@@ -53,7 +53,8 @@ describe 'mail_room.yml' do ...@@ -53,7 +53,8 @@ describe 'mail_room.yml' do
email: 'gitlab-incoming@gmail.com', email: 'gitlab-incoming@gmail.com',
password: '[REDACTED]', password: '[REDACTED]',
name: 'inbox', name: 'inbox',
idle_timeout: 60 idle_timeout: 60,
expunge_deleted: true
} }
expected_options = { expected_options = {
redis_url: gitlab_redis_queues.url, redis_url: gitlab_redis_queues.url,
......
...@@ -9,6 +9,7 @@ test: ...@@ -9,6 +9,7 @@ test:
ssl: true ssl: true
start_tls: false start_tls: false
mailbox: "inbox" mailbox: "inbox"
expunge_deleted: true
service_desk_email: service_desk_email:
enabled: true enabled: true
...@@ -20,3 +21,4 @@ test: ...@@ -20,3 +21,4 @@ test:
ssl: true ssl: true
start_tls: false start_tls: false
mailbox: "inbox" mailbox: "inbox"
expunge_deleted: true
...@@ -13,7 +13,8 @@ describe Gitlab::MailRoom do ...@@ -13,7 +13,8 @@ describe Gitlab::MailRoom do
start_tls: false, start_tls: false,
mailbox: 'inbox', mailbox: 'inbox',
idle_timeout: 60, idle_timeout: 60,
log_path: Rails.root.join('log', 'mail_room_json.log').to_s log_path: Rails.root.join('log', 'mail_room_json.log').to_s,
expunge_deleted: false
} }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment