Skip to content
Snippets Groups Projects
Commit 036d5191 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

lib-sieve: vacation extension: Use Microsoft X-Auto-Response-Suppress header...

lib-sieve: vacation extension: Use Microsoft X-Auto-Response-Suppress header to prevent unwanted responses.

We've seen a few situations where Pigeonhole and Microsoft products start a useless machine conversation.
At least older versions of Outlook ignore the standards on multiple points to make this happen.
We prevent this now by recognizing and generating the X-Auto-Response-Suppress header.
parent 32e7781d
No related branches found
No related tags found
No related merge requests found
......@@ -982,6 +982,9 @@ static int act_vacation_send
rfc2822_header_write(msg, "Auto-Submitted", "auto-replied (vacation)");
rfc2822_header_write(msg, "Precedence", "bulk");
/* Prevent older Microsoft products from replying to this message */
rfc2822_header_write(msg, "X-Auto-Response-Suppress", "All");
rfc2822_header_write(msg, "MIME-Version", "1.0");
if ( !ctx->mime ) {
......@@ -1158,6 +1161,32 @@ static int act_vacation_commit
hdsp++;
}
/* Check for the (non-standard) Microsoft X-Auto-Response-Suppress header */
if ( mail_get_headers
(mail, "x-auto-response-suppress", &headers) < 0 ) {
return sieve_result_mail_error(aenv, mail,
"vacation action: "
"failed to read header field `x-auto-response-suppress'");
}
/* Theoretically multiple headers could exist, so lets make sure */
hdsp = headers;
while ( *hdsp != NULL ) {
const char *const *flags = t_strsplit(*hdsp, ",");
while ( *flags != NULL ) {
const char *flag = t_str_trim(*flags, " \t");
if ( strcasecmp(flag, "All") == 0 ||
strcasecmp(flag, "OOF") == 0 ) {
sieve_result_global_log(aenv,
"discarding vacation response to message from <%s> "
"(`%s' flag found in x-auto-response-suppress header)",
str_sanitize(sender, 128), flag);
return SIEVE_EXEC_OK;
}
flags++;
}
hdsp++;
}
/* Do not reply to system addresses */
if ( _is_system_address(sender) ) {
sieve_result_global_log(aenv,
......
......@@ -146,6 +146,99 @@ test "No reply to auto-submitted mail" {
}
}
/*
* No reply to Microsoft X-Auto-Response-Suppress - All
*/
test_result_reset;
test_set "message" text:
From: spam@example.com
To: stephan@example.com
X-Auto-Response-Suppress: All
Subject: Frop!
Frop!
.
;
test_set "envelope.from" "spam@example.com";
test_set "envelope.to" "stephan@example.com";
test "No reply to Microsoft X-Auto-Response-Suppress - All" {
vacation "I am gone";
if not test_result_execute {
test_fail "failed to execute vacation";
}
if test_message :smtp 0 {
test_fail "vacation not supposed to send message";
}
}
/*
* No reply to Microsoft X-Auto-Response-Suppress - OOF
*/
test_result_reset;
test_set "message" text:
From: spam@example.com
To: stephan@example.com
X-Auto-Response-Suppress: OOF
Subject: Frop!
Frop!
.
;
test_set "envelope.from" "spam@example.com";
test_set "envelope.to" "stephan@example.com";
test "No reply to Microsoft X-Auto-Response-Suppress - OOF" {
vacation "I am gone";
if not test_result_execute {
test_fail "failed to execute vacation";
}
if test_message :smtp 0 {
test_fail "vacation not supposed to send message";
}
}
/*
* No reply to Microsoft X-Auto-Response-Suppress - DR,OOF,RN
*/
test_result_reset;
test_set "message" text:
From: spam@example.com
To: stephan@example.com
X-Auto-Response-Suppress: DR, OOF, RN
Subject: Frop!
Frop!
.
;
test_set "envelope.from" "spam@example.com";
test_set "envelope.to" "stephan@example.com";
test "No reply to Microsoft X-Auto-Response-Suppress - DR,OOF,RN" {
vacation "I am gone";
if not test_result_execute {
test_fail "failed to execute vacation";
}
if test_message :smtp 0 {
test_fail "vacation not supposed to send message";
}
}
/*
* No reply to system address
*/
......@@ -252,6 +345,7 @@ To: stephan@example.com
Subject: Frop!
Auto-submitted: no
Precedence: normal
X-Auto-Response-Suppress: None
Frop!
.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.