nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
842 stars 260 forks source link

Attachments not shown #4423

Open yward opened 3 years ago

yward commented 3 years ago

Expected behavior

When you recieve an email that has an attachment it should be shown/available for you to download, regardless of sender.

Actual behavior

The attachments behaviour is not consistent, here's a thorough explanation of the situation:

-Most emails with attachments display correctly, however I've noticed that dmarc emails sent by google to our noreply email do not shown the attached zip file containing the report, yahoo's dmarc emails are showing attachments, but not gmail's.

Here's a screen shot showing the inbox in mail app: https://i.imgur.com/igz3YgW.png You can notice that only the 2nd email (which is yahoo's) shows an attachment, all gmail dmarc reports are showing without attachments.

Here's the same email inbox, but using roundcube instead of NC mail app: https://i.imgur.com/7rtQSVW.png As you can see every single email has an attachment if I use roundcube to explore the emails, but not NC's email app.

The behaviour is very confusing to me, I do not understand why would one email display an attachment but not the other.

Mail app

Mail app version: 1.8.0

Mailserver or service: EXIM/Dovecot

Server configuration

Operating system: Ubuntu 18.04

Web server: Apache

Database: MySQL 10.3.22

PHP version: 7.4.7

Nextcloud Version: 20.0.5

Client configuration

Browser: Firefox 84.0.2

Operating system: Windows 10

ChristophWurst commented 3 years ago

what's the header info on those mime parts?

yward commented 3 years ago

what's the header info on those mime parts?

Here's gmail's raw email in nextcloud client:

https://pastebin.com/CVA5hFtz

I'm not advanced with email servers, but I can clearly see the attachment in the mime.

Here's yahoo's: https://pastebin.com/zxj0F789

yward commented 3 years ago

Maybe related to #4463 ?

StCyr commented 3 years ago

what's the header info on those mime parts?

Here's gmail's raw email in nextcloud client:

https://pastebin.com/CVA5hFtz

I'm not advanced with email servers, but I can clearly see the attachment in the mime.

Here's yahoo's: https://pastebin.com/zxj0F789

The gmail's raw email doesn't look complete: I can't do anything with it.

Would you mind sharing a complete one with us (I don't know how sensitive is a dmarc report)?

In particular, I would like more insight on the somekey at line 144 in https://pastebin.com/CVA5hFtz,

yward commented 3 years ago

@StCyr the "somekey" is literally just that, some hex gibberish. Anyway, here's another unedited raw message from gmail dmarc reports that includes all data including said key: https://pastebin.com/1Cmt1UK0 (Paste will expire in 1 month)

Mailserver data is not sensitive for human users (i.e. if I send you an email) but bots tend to spam IPs/domains they find in public forums and pastes hence why I originally obscured the original paste.

Keep in mind this exact same message shows an attachment in Roundcube but not "Nextcloud mail", I haven't tried it in the original horde since I do not happen to have it installed in any of my servers.

Let me know if I can provide any more data to debug the issue.

StCyr commented 3 years ago

The problem is that the message has no body. Or at least, Horde doesn't find one.

The issue occurs here:

https://github.com/nextcloud/mail/blob/585d7c47309f180f5a79dcbf7735b96196ee210a/lib/Model/IMAPMessage.php#L379

Where the returned value from the findBody function is indeed null.

I have no idea how to fix that though. Any idea @ChristophWurst ?

ChristophWurst commented 3 years ago

Phew. That's some really old code. I don't know either.

solracsf commented 3 years ago

I'm having a similar issue, can't say if it's related or not, this is a regular mail. In the left pane, an attachment is shown, but in the body, can't find any way to download it.

NC 20.0.8, Mail 1.9.4

image

craigesk commented 3 years ago

@acsfer I see the same issue. In all cases for me these are for emails that have been forwarded to me. NC 20.0.8, Mail 1.9.3 edit: I just updated to mail 1.9.5 and this appears to be fixed for me

ChristophWurst commented 3 years ago

yep, v1.9.5 included @StCyr's attachment classification fixes.

I'm closing this ticket thus.

yward commented 3 years ago

@ChristophWurst Please reopen the ticket. The problem has not been solved. The original problem I reported doesn't detect any attachments at all if the message has no body. The 2 comments above are a different problem where an attachment icon is present but when you open the email you do not find it.

ChristophWurst commented 3 years ago

Please beware that the icon in the message list might now be in a wrong state. If I remember correctly we analyze a message just once. If it was classified to have an attachment wrongly in the past then the icon won't change now despite the new logic.

yward commented 3 years ago

The conclusion I remember we reached is that the attachment is present indeed in the raw email, but for some reason it doesn't show or display in a message if that message had no body. And a good example emails where this happens is Gmail's dmarc reports. (The icon being present or not wasn't the original issue)

The issue is not present in other email clients so it was traced back to horde's (potentially). I will try to work on the issue on my end and send a pull request if I succeed.

thstyl2000 commented 3 years ago

I have also had this (attachment not shown) issue, also with messages containing "some text" (at least signatures...). Would it help if I somehow share the emails?

mepsteinj commented 3 years ago

I'm seeing the same problem in Nextcloud 21.0.5 with emails sent from noreply-dmarc-support[at]google.com, attachments are not displayed.

ChristophWurst commented 3 years ago

Please provide the raw message as exported .eml or similar so someone will be able to reproduce with your message.

Otherwise please add your :+1: to the original report if you are affected by this. The comments only generate a notification for everyone in here without much value. Thanks :)

aharish commented 2 years ago

I have the same issue as the OP. I'm sharing a folder with the .mbox extension here that I exported from Evolution mail. If someone can tell me how to export to an .eml file, I will be able to provide that as well in the same folder. Here's the link: https://nc.aharish.xyz/s/xGSfQmo7bXQPNew (Expires in a month)

Edit: FWIW I have a dmarc report from Zoho mail as well, and it shows the attachment just fine on Nextcloud Mail because Zoho very kindly includes some text to the body.

osscombat commented 1 year ago

Got this bug as well on Google's DMARC email with an empty body.

Mail app v2.2.5 Nextcloud v25.0.5

jcaBelAir commented 4 months ago

I am having the same issue here, also with a Google DMARC report email. No attachment icon in the NC Mail inbox listing; nothing appears in the body of the email in the viewer pane. Email with attachment appears as expected in Outlook Android client, Outlook Desktop client and Gmail Android Client.

I have attached a zipped copy of the eml downloaded from the NC Mail client.
This is a fresh install (yesterday) using the latest Docker image from the Knex666 Repository running on Unraid Server (6.12.10) Mail App v3.6.1 Nextcloud Hub 8 (29.0.1)

Could the exclaimation marks in the attachment filename be part of the cause? google.com!adultingrejects.com!1717372800!1717459199.zip

Report domain adultingrejects.com Submitter google.com Report-ID_ 7405547543268541980.zip

ChristophWurst commented 1 month ago

I can reproduce with @jcaBelAir's email.