Skip to content

Count of attachments is wrong #412

Open
@TonyMarston

Description

Describe the bug
When I have an email that contains both plain text and an HTML body the attachment count shows up as 1 instead of zero. When I iterate through the attachments I notice that the non-attachment does not contain the text: 'Content-Disposition: attachment;'

When I examine the email source I see the following entries:
Content-Type: multipart/mixed;
Content-Type: multipart/alternative;
Content-Type: text/plain;
Content-Type: text/html;

The non-attachment showed the contents of the multipart/mixed entry;

A real attachment contains the lines:
Content-Type: application/pdf; name="blahpdf"
Content-Disposition: attachment;

Expected behavior
I expect the count of attachments to be accurate.

Suggested Fix
I stepped through the code and found this at line 288 in part.php
if (($this->subtype == null || in_array((strtolower($this->subtype)), ["plain", "html"])) && $this->filename == null && $this->name == null) {
I changed it to ["plain", "html", "mixed"] and this fixed the problem.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions