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

[Bug] E-mail reports are not displayed correctly #22516

Open
4 tasks done
lourdas opened this issue Aug 19, 2024 · 9 comments
Open
4 tasks done

[Bug] E-mail reports are not displayed correctly #22516

lourdas opened this issue Aug 19, 2024 · 9 comments
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member

Comments

@lourdas
Copy link
Contributor

lourdas commented Aug 19, 2024

What happened?

I've configured automated email reports for my Matomo installation for two sites. The e-mails are sent, but they are not displayed in Thunderbird:

Screenshot_20240819_181943

The email message size is not zero, the size for the e-mail at the above screenshot is 952KB.

The HTML message source code is something like this:

Screenshot_20240819_182229

The same result is when I send the e-mail reports manually from the administration interface.

I've also stumbled upon this PHP bug. Could this be somehow related?

My vps is a Linux server, with PHP 8.1.29 FPM and Apache 2.4.62.

What should happen?

The email reports should look fine in Thunderbird, like this:

Screenshot_20240819_185353

This is from another Matomo installation with PHP 8.1.29 too that I manage.

How can this be reproduced?

Can't really tell, since I don't know if this is PHP related or something else. This is an old installation from many years ago, but email reports used to work fine.

Matomo version

5.1.1

PHP version

8.1.29

Server operating system

Linux

What browsers are you seeing the problem on?

Not applicable (e.g. an API call etc.)

Computer operating system

Linux

Relevant log output

No response

Validations

@lourdas lourdas added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Aug 19, 2024
@des-innocraft
Copy link

@lourdas thank you for raising this ticket. Can I ask if you still encounter the same issue on Thunderbird?

I tried replicating but got no luck:
Screenshot 2024-09-02 at 7 37 55 AM

If yes, can I ask what is the Thunderbird version you used? Also do you experience the same on other email apps?

@lourdas
Copy link
Contributor Author

lourdas commented Sep 2, 2024

Hi @des-innocraft

This is Thunderbird 115.14.0. I administer another Matomo installation which is hosted in a different server and the e-mail reports are sent and displayed fine in the same Thunderbird installation:

image

So, I guess something must be configured incorrectly in the server.

Help is needed to debug this issue. What information do you need in this direction?

@des-innocraft
Copy link

@lourdas thank you for the reply. I assumed this only happens in one of your server. This might be a server configuration issue. Does this server has the same server configuration with the new installation on another server(where email works as expected)?

Can you export the email where the error happens ans we'll see if we can reproduce? Also, this error only happens on Thunderbird and not other mail app or webclient?

@lourdas
Copy link
Contributor Author

lourdas commented Sep 6, 2024

@des-innocraft This is a screenshot of my web mail displayin the report:

image

Which is actually the source code of the message in Thunderbird:

image

(I'm showing the source code, since Thunderbird cannot decode the message properly and actually displays a blank page, see my initial message).

You write about exporting the email. What exactly do you mean?

@des-innocraft
Copy link

@lourdas thank you for your reply. What I meant for exporting the email is saving the email file and attached it here so we can try check and try to reproduce. Currently we are not able to reproduced and not aware of any existing issue like this. This maybe a rare case happening only on your instance.

Have you tried other mail client like Outlook to see if the emails are like this as well?

@lourdas
Copy link
Contributor Author

lourdas commented Sep 12, 2024

I've attached the problematic report.

No, I haven't tried other mail clients besides Thunderbird and my webmail, but I highly doubt the client is the issue here. My Thunderbird installation works perfectly. The e-mails generated from this specific installation are the issue.
report.zip

@des-innocraft
Copy link

@lourdas thank you for sending the problematic report. I can view the attach email report and see the issue. We cant tell though the exact cause as this is the first time we heard about this issue and also we cannot replicate.

The issue you are encountering on this specific email report maybe related to the php/php-src#8086 you mentioned.

@chriscroome
Copy link

I think I have replicated this issue on a development server, this is with PHP 8.3:

php --version
PHP 8.3.12 (cli) (built: Sep 27 2024 04:03:53) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.12, Copyright (c), by Zend Technologies

With no email setting in config/config.ini.php and looking at the email report in a SOGo webmail client I have:

Screenshot 2024-10-07 at 12-21-41 (106744) Inbox Mail SOGo Groupware

After adding the following to config/config.ini.php:

[mail]
transport = "smtp"
port = "25"
host = "localhost"
encryption = "none"

And again clicking "Send Report now" I get a email that looks like this:

Screenshot 2024-10-07 at 12-23-30 (106744) Inbox Mail SOGo Groupware

If I view the email source in mutt / vim the one that was sent using PHP Mail and is incorrectly formatted has the following, is the additional carriage return in the Content-Type: header the issue?

MIME-Version: 1.0                                                                                                                                                                                                                                                               
Content-Type: multipart/alternative;                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                
        boundary="b1=_uIWcKcLd8h5Asr890ErcLga9ueg0bdbOx5mLCQFM"      
X-Last-TLS-Session-Version: TLSv1.3   
X-Rspamd-Queue-Id: 972A81A8E125                                                                                                                                                                                                                                                 


Content-Type: text/html; charset=utf-8

Content-Transfer-Encoding: quoted-printable


<html style=3D"background-color:#edecec">



<head>

    <meta charset=3D"utf-8">

    <meta name=3D"robots" content=3D"noindex,nofollow">

    <meta name=3D"generator" content=3D"Matomo Analytics">

</head>

The email that was sent via SMTP has:

MIME-Version: 1.0                                                                                                                                                                                                                                                               
Content-Type: multipart/alternative;                                                                                                                                                                                                                                            
        boundary="b1=_F1Q5NHaaaXeduucFHPHMcYgAZrGwpDxbK1bwRGZY"                                                                                                                                                                                                                 
X-Last-TLS-Session-Version: TLSv1.3  

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Dashboard

Is there anything further I can do to help debug this issue?

For now I'm going to change all the production instances of Matomo we host to use SMTP rather than PHP Mail.

@lourdas
Copy link
Contributor Author

lourdas commented Oct 7, 2024

@chriscroome From your reply, I realize that the problem boils down to the PHP bug that was mentioned in the previous messages. When you changed the configuration settings in the ini, you essentially changed the way the e-mail reports are sent. Instead of using the internal PHP mail() function, the SMTP server is used to send the email, which is unaffected by the PHP issue.

I will test the same configuration and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member
Projects
None yet
Development

No branches or pull requests

3 participants