nextcloud / nextcloud/mail

Attachments not decoded when using DavMail

Open
#6,878 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. to triage bug
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Steps to reproduce
  1. Setup DavMail to access Exchange Mails.
  2. Receive an E-Mail with a pdf attachment.
  3. Attachment is recognized as a pdf but mail app downloads an eml file.
Expected behavior

Mail app decodes the attachment and downloads a pdf file.

Actual behavior

Mail app downloads an eml file containing the base64 encoded pdf. If I send the same message to another imap account, the attachment is downloaded correctly.

Mail app version

1.13.6

Mailserver or service

Posteo to Exchange

Operating system

Debian

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database

MariaDB

Additional info

Source of the DavMail message (shortened):

`
From: leArthurDent leArthurDent@imap1.de
To: leArthurDent leArthurDent@exchange.de
Cc:
Subject: Test with attachment
Date: Thu, 14 Jul 2022 08:24:13 +0000
Content-Type: multipart/mixed; boundary="=_2uho0oxLZMELMX2D26w5gRQ"
Content-Transfer-Encoding: 8bit
Return-Path: leArthurDent@imap1.de
MIME-Version: 1.0

--=_2uho0oxLZMELMX2D26w5gRQ
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

The attachment should be below.

--=_2uho0oxLZMELMX2D26w5gRQ
Content-Type: application/pdf; name="jasms.0c00467.pdf"
Content-Disposition: attachment; filename="jasms.0c00467.pdf"
Content-Transfer-Encoding: base64

(...)

--=_2uho0oxLZMELMX2D26w5gRQ--
`

Source of the other IMAP message (shortened):

`Subject: Test with attachment
From: leArthurDent leArthurDent@imap1.de
To: leArthurDent leArthurDent@imap2.de
Date: Thu, 14 Jul 2022 08:35:39 +0000
Content-Type: multipart/mixed; boundary="=-QvVGVSEVGreoqqpY/CUn"
MIME-Version: 1.0

--=-QvVGVSEVGreoqqpY/CUn
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

The attachment should be below.

--=-QvVGVSEVGreoqqpY/CUn
Content-Type: application/pdf; name="jasms.0c00467.pdf"
Content-Disposition: attachment; filename="jasms.0c00467.pdf"
Content-Transfer-Encoding: base64

(...)

--=-QvVGVSEVGreoqqpY/CUn--

`

First I thought the issue would be due to mail app not being able to read embedded messages, but these sources look almost the same.

Fun Fact: If I send the message from imap1 to exchange, I cannot download the pdf. If I forward it back from exchange to imap1, I can.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the attachment download with DavMail and compare the raw MIME structure against the working IMAP message, focusing on the multipart and base64 sections shown in the report. Done means the PDF is decoded and downloaded as a PDF rather than as an EML file, with the behavior verified on the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.