Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic out-of-office replies #5441

Closed
Tracked by #5478
nimishavijay opened this issue Aug 13, 2021 · 11 comments · Fixed by #7102
Closed
Tracked by #5478

Automatic out-of-office replies #5441

nimishavijay opened this issue Aug 13, 2021 · 11 comments · Fixed by #7102
Assignees
Labels
3. to review design enhancement feature parity skill:frontend Issues and PRs that require JavaScript/Vue/styling development skills
Milestone

Comments

@nimishavijay
Copy link
Member

nimishavijay commented Aug 13, 2021

Is your feature request related to a problem? Please describe.

It would be very useful to be able to set an automatic reply for a specified period of time, like if you are on vacation. All major email clients have this as a feature (Gmail, Thunderbird, Outlook, Apple Mail, Mailbird).

Describe the solution you'd like

In Gmail there is an option in the settings page where it can be set and configured. We can also have it in the account settings.
image

Modifications from how Gmail does it

  • Without rich text (just plain text)
  • Without "Only send messages to my contacts"
  • But with the "If a contact sends you several messages, this automated reply will be sent at most once every 4 days"

Describe alternatives you've considered

N/a

Additional context

This can also tie in with the status, eg, if you set your status as vacationing, then for that period the out-of-office reply could be enabled automatically.

cc @jancborchardt @karlitschek

Implementation

We can do this via the Sieve vacation extension: https://datatracker.ietf.org/doc/html/draft-ietf-sieve-vacation-07

Writing the rule

As a minimal version we will add a form to the user interface where users can fill in the details of their vacation. From this information we will derive a Sieve script that is pushed to the Sieve server.

Reading the rule

Once a rule has been written and the UI is opened again, we will have to read back the contents of the active Sieve script and find out of it was written by this app or someone else. Then we have to read back the vacation details, or store them somewhere else, to hydrate the form.

We might have to add a hash comment or similar to the script to determine if the script was edited externally.

Updating the rule

Update is like write, we replace the full script.

Deleting the rule

Deleting the rule will erase the full script.

Design specification

Mockup of the settings UI if the server doesn't support Sieve

tbd

Mockup of the settings UI if there is an existing, incompatible Sieve script that we have to overwrite (data loss)

tbd

Mockup of the settings UI if Sieve is available but the vacation extension is not

tbd

Mockup of the settings UI if Sieve is available and there is no active script

tbd

@karlitschek
Copy link
Member

Great idea 👍

@ChristophWurst

This comment was marked as outdated.

@ArnY
Copy link
Contributor

ArnY commented Oct 31, 2021

This should be done on the server. We support Sieve. Sieve can do this +1

This will require some configuration system wide (or mail server wide if using provisionning?) to be sure admins can blacklist mails from being replied to:

  • blacklisted headers (and headers values)
  • blacklisted senders
    ..

Headers and footer for the replies might also need to be configured somewhere.

Also, it will require storing each sender that was replied to and the date it was done since for each user to be sure only one reply per day should be sent and avoid spamming.

Some resources:
https://datatracker.ietf.org/doc/html/rfc3834 (rfc on automatic responses)
http://www.onyxbits.de/gnarwl (Gnarwl - LDAP based email autoresponder, simple yet efficient that allows to blacklist headers, set headers and footers, etc.)

@stale
Copy link

stale bot commented Apr 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 30, 2022
@ChristophWurst ChristophWurst moved this from 🧭 Planning evaluation (dont pick) to 📄 To do (5-20 entries) in 💌 📅 👥 Groupware team May 5, 2022
@ChristophWurst
Copy link
Member

I have updated the description with some details regarding implementation as well as mockups to design.

This can also tie in with the status

This seems like a critical point to clarify: where is the unavailability defined? As a user I do not want to set my absence in multiple places. Ideally this happens centrally. This could be somewhere in the personal Nextcloud settings, via special events in my calendar nextcloud/calendar#3305 or similar. The user status and the OOO Mail reply are derived from this central information.

There seem to be alternative ideas like that the unavailability is defined in Mail and then creates a calendar entry.

One more thing to note is that with the example of Gmail there is always just one time frame where I can set myself absent. I can't proactively add all my vacations.

@ChristophWurst ChristophWurst added the skill:frontend Issues and PRs that require JavaScript/Vue/styling development skills label Jul 16, 2022
@miaulalala
Copy link
Contributor

miaulalala commented Aug 9, 2022

The sieve rule that needs to be created:

require "fileinto";
require "date";
require "relational";
require "vacation";
# Dates need to be one lower than start
# and one higher than end to match
if allof(currentdate :value "gt" "date" "2022-08-09",
              currentdate :value "lt" "date" "2022-08-27"
    ) {
  vacation
    :from "Test Test <[email protected]>"
    :subject "SUBJECT HERE"
    # Changeable: reply once every x days you'll be out of office, in this case every day
    :days 1
    # Aliases should be includable
    # If a mail's recipient is not the envelope recipient and it's not on this list,
    # no vacation reply is sent for it.
    :addresses ["[email protected]", "[email protected]"]
  "TEXT HERE"

if there's some specific emails that should not get an OOO reply, they could be excluded by using

if not address "From" "[email protected]"

@ChristophWurst
Copy link
Member

Script insertion option 1 - require block + script block

# NEXTCLOUD MAIL - DO NOT EDIT
require "date";
require "relational";
require "vacation";
# END NEXTCLOUD MAIL - EDIT BELOW



## Generated by RoundCube Webmail SieveRules Plugin ##
require ["fileinto"];

# rule:[test]
if anyof (header :contains "Subject" "test")
{
        fileinto "INBOX";
}
# rule:[test2]
elsif anyof (header :contains "Subject" "t<C3><A4>st")
{
        fileinto "INBOX";
}

# Sentry
if address :is "from" "[email protected]" {
  fileinto "Sentry";
  stop; # vacation rule not processed
}



# NEXTCLOUD MAIL - DO NOT EDIT BELOW
# { "version": 1, "from":"2022-08-09", "to":"" }
if allof(currentdate :value "gt" "date" "2022-08-09",
              currentdate :value "lt" "date" "2022-08-27"
    ) {
  vacation
    :from "Test Test <[email protected]>"
    :subject "SUBJECT HERE"
    # Changeable: reply once every x days you'll be out of office, in this case every day
    :days 4
    # Aliases should be includable
    # If a mail's recipient is not the envelope recipient and it's not on this list,
    # no vacation reply is sent for it.
    :addresses ["[email protected]", "[email protected]"]
  "TEXT HERE"

Script insertion option 2 - one block

require ["mailbox", "fileinto", "date", "relational"];


# NEXTCLOUD MAIL - DO NOT EDIT
require "date";
require "relational";
require "vacation";
# { "from":"2022-08-09", "to":"" }
if allof(currentdate :value "gt" "date" "2022-08-09",
              currentdate :value "lt" "date" "2022-08-27"
    ) {
  vacation
    :from "Test Test <[email protected]>"
    :subject "SUBJECT HERE"
    # Changeable: reply once every x days you'll be out of office, in this case every day
    :days 1
    # Aliases should be includable
    # If a mail's recipient is not the envelope recipient and it's not on this list,
    # no vacation reply is sent for it.
    :addresses ["[email protected]", "[email protected]"]
  "TEXT HERE"
# END NEXTCLOUD MAIL - EDIT BELOW


# Sentry
if address :is "from" "[email protected]" {
  fileinto "Sentry";
  stop;
}

Notes

  • stop; stops any other rules
  • fileinto also skips vacation etc
  • If the script can't be saved (generic error) we show it to the user
    • Tell them they can edit manually
    • Optionally offer a script reset (with confirmation)

@ChristophWurst ChristophWurst moved this from 📄 To do (~10 entries) to 🏗️ In progress in 💌 📅 👥 Groupware team Aug 26, 2022
@ChristophWurst
Copy link
Member

@st3iny regarding enabling/disabling OOO and not losing the previous config. I suppose that if OOO is disabled we remove all of our script/require code but leave the metadata comment

@ChristophWurst ChristophWurst added this to the v1.14.0 milestone Aug 30, 2022
@ChristophWurst
Copy link
Member

Is it actually possible that a Sieve server doesn't come with the vacation module? Can we check this somehow?

@st3iny
Copy link
Member

st3iny commented Sep 2, 2022

Is it actually possible that a Sieve server doesn't come with the vacation module? Can we check this somehow?

I didn't find a way to check if the vacation module is enabled. It doesn't have to be available and might be disabled by admins (e.g. https://doc.dovecot.org/configuration_manual/sieve/extensions/vacation/).

I could imagine that saving the script will fail if the vacation module is disabled so we might show a warning to the user in this case.

@ChristophWurst
Copy link
Member

Okay then let's only catch script saving errors for now.

@ChristophWurst ChristophWurst modified the milestones: v1.14.0, v2.0.0 Sep 2, 2022
Repository owner moved this from 🏗️ In progress to ☑️ Done in 💌 📅 👥 Groupware team Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review design enhancement feature parity skill:frontend Issues and PRs that require JavaScript/Vue/styling development skills
Projects
Development

Successfully merging a pull request may close this issue.

7 participants