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

prevent vacation messages in response to Email reports #16288

Closed
Bad-and-Mad opened this issue Aug 12, 2020 · 5 comments · Fixed by #16292
Closed

prevent vacation messages in response to Email reports #16288

Bad-and-Mad opened this issue Aug 12, 2020 · 5 comments · Fixed by #16292
Assignees
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Milestone

Comments

@Bad-and-Mad
Copy link

Bad-and-Mad commented Aug 12, 2020

dear ladies and gentlemen,

would you possibly include a parameter "Auto-Submitted: yes"
for the header of the matomo-email-reports to prevent vacation messages?

as described at

https://tools.ietf.org/html/rfc5230#section-4.6
and
https://tools.ietf.org/html/rfc5230#section-5.6

Thank you

I added this in my case by "hardcoding" the ".../libs/Zend/Mail.php":

cat ~/Piwik_01/libs/Zend/Mail.php | grep -in -A10 -B20 "by M.W."
----------------------------------------------------------------

523-    protected function _storeHeader($headerName, $value, $append = false)
524-    {
525-        if (isset($this->_headers[$headerName])) {
526-            $this->_headers[$headerName][] = $value;
527-        } else {
528-            $this->_headers[$headerName] = array($value);
529-        }
530-
531-            if ($append) {
532-            $this->_headers[$headerName]['append'] = true;
533-        }
534-
535:            // by M.W.
536-            if ( null === $this->_headers[ 'Auto-Submitted' ] ) {
537-            $this->_headers[ 'Auto-Submitted' ][] = 'yes';
538-        }
539-
540-    }
@Findus23
Copy link
Member

Findus23 commented Aug 12, 2020

Hi,

I have never heard of this header before outside of Auto-Submitted: auto-generated in the vacation message to prevent endless responses and a quick search through my inbox doesn't contain a single E-mail with an Auto-Submitted: yes header and all Auto-Submitted: auto-generated emails are from the Matomo forum (powered by discourse). It seems discourse also adds X-Auto-Response-Suppress: All which maybe also should be added.

https://github.com/discourse/discourse/blob/c72bc27888df772200add0dbd3ebc9551ecfd1a3/lib/email/message_builder.rb#L153-L154

But it seems reasonable and simple to add it. Since Matomo 4, Matomo uses phpmailer to send, so you probably want to add
$phpMailer->addCustomHeader('Auto-Submitted', 'yes'); somewhere here:

public function send(Mail $mail)
{
$phpMailer = new PHPMailer(true);
PHPMailer::$validator = 'pcre8';
$phpMailer->CharSet = PHPMailer::CHARSET_UTF8;
$phpMailer->Encoding = PHPMailer::ENCODING_QUOTED_PRINTABLE;
$phpMailer->XMailer = ' ';
$phpMailer->setLanguage(StaticContainer::get('Piwik\Translation\Translator')->getCurrentLanguage());
$this->initSmtpTransport($phpMailer);
if ($mail->isSmtpDebugEnabled()) {
$phpMailer->SMTPDebug = SMTP::DEBUG_SERVER;
}

If you want to, please create a Pull Request with this change against Matomo 4.x-dev.

@Findus23 Findus23 added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. labels Aug 12, 2020
@Bad-and-Mad
Copy link
Author

Thank you for the fast reaction!

It doesn't matter whether you set the parameter to "Auto-Submitted: auto-generated" or to "Auto-Submitted: yes".

The only thing that matters is how in

https://tools.ietf.org/html/rfc5230#section-4.6

described:

"Implementations SHOULD NOT respond to any message that has an" Auto-submitted "header field with a value other than" no ". This header field is described in [RFC3834]."

It should simply be prevented that a sieve filter sends a vacation notification as an automatic response to emails from the Matomo installation.

My current version is "Matomo-Version: 3.14.0". There is no such file "Transport.php" here.

In addition, changes to the code result in file integrity warnings.

Perhaps this could be solved a little more elegantly by introducing a configuration parameter in the Matomo backend.

@Findus23
Copy link
Member

Hi,

What I was proposing was that you create a pull request here on Github to make the change for everyone, so that this is fixed when Matomo 4 will come out. But if you want to, I can also do it for you.

@Bad-and-Mad
Copy link
Author

Would you please create the pull request?

Thank you so much!

@Findus23
Copy link
Member

@Bad-and-Mad I created #16292 with the change.

@mattab mattab modified the milestones: Backlog (Help wanted), 4.0.0 Sep 10, 2020
@mattab mattab changed the title prevent vacation messages prevent vacation messages in response to Email reports Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants