sympa-community / sympa

Sympa, Mailing List Management Software
https://www.sympa.community/sympa
GNU General Public License v2.0
244 stars 96 forks source link

How to prevent "noname" attachments for HTML emails with images #1268

Open qulien opened 2 years ago

qulien commented 2 years ago

Version

Expected behavior

No attachments for emails with no attachments.

Actual behavior

When I send out an HTML email (from an HTML file), which contains images (<img src="http://example.com/example.jpg">), it seems that Sympa is creating some code that leads to attachments. One attachment per image, if I'm not mistaken.

--_----------=_163548878950826
Content-Id: <5706c6f6164732f323032312f31302f7474635f74657374322e6a7067@MIME-Lite-HTML-1.24>
Content-Transfer-Encoding: base64
Content-Type: image/jpg
Date: Fri, 29 Oct 2021 15:26:29 +0900
Content-length: 45222

This will then be displayed as noname attachments in G-Mail, for example, and potentially similarly in other clients.

Additional information

I'd like to find a way to prevent this from happening.


[EDIT by admin]

Reproduced with these MUAs:

Not reproduced with these MUAs:

racke commented 2 years ago

You are sending the HTML file from the web interface?

qulien commented 2 years ago

@racke thanks for your swift reply. Yes, that is correct.

Also, I forgot to mention: I tried both, append and mime for the footer_type option. Attachments showing up in both cases.

ikedas commented 2 years ago

@qulien , could you please show entire content (header and body) of the message?

qulien commented 2 years ago

I've stripped out some sensitive information, but otherwise left it as-is:

Delivered-To: qulien+sympa@test-mail.example.com
Received: by 2002:a05:6214:27ed:0:0:0:0 with SMTP id jt13csp2002473qvb;
        Thu, 28 Oct 2021 23:26:37 -0700 (PDT)
X-Google-Smtp-Source: ABdhPJy63AVq0nS3KauHu+21ZJAjyE6p0xnVdkqrhv4gS/VDzdoQZE7xUruS7WpjHzv36jyS6GaW
X-Received: by 2002:a17:903:234a:b0:13e:f01a:24f with SMTP id c10-20020a170903234a00b0013ef01a024fmr8107690plh.43.1635488797621;
        Thu, 28 Oct 2021 23:26:37 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1635488797; cv=none;
        d=google.com; s=arc-20160816;
        b=fImMjAZeC2HZHToxLFG2ZdPFbv5qsE9+XATpYPfgBwJzPdfkV6A3sPaRPBJFq/3sjg
         ZM5jHfdc5bdsVuBY9kSa7Wd3V5erKl5WEj2AtWmMBlh2ozVwVjmXPee1N+0YtBO+6vkl
         E+DAWmw7cPlbn4z2jzVTRDDi3awakfUCTSfGh40IGqjuaiNrKvE/ZZriJ5xOzFYstrP0
         aoigX6f4Q0a5HTi+IS27DsyJmjuBPNK8cs1rLATFuIIFrVt1/EcDUzMs9JU1L2gJavKR
         KRdeK2yZGMjS1OCkk7l1uDnnrmpRageqAxYeNsPKsYWGgMBdvG1EkoRLNpvK2fvODLYG
         5HXw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=archived-at:list-archive:list-owner:list-post:list-unsubscribe
         :list-subscribe:list-help:list-id:sender:precedence:precedence
         :errors-to:reply-to:subject:message-id:to:from:date:mime-version
         :content-transfer-encoding;
        bh=ts5ZExfCVnSuwCGFJU7OTQ/dI7tDrrtZw+l0ADx7gfs=;
        b=h7+B9hiljlIGWR8rqAuRYSW0USoUzPZF3kIXyEsYctimGgLg4AYDDWoedn8X8JW7a0
         6n7FOPKe6AKmewpzgHZjwN2BjC9eDj/BMn2muWd1zvCHuLrQsERIHPtHzMWGqQ4rHoxP
         6DSWIbIwhOMYQCZsDopS3ESlkE8vZM/JQVqnnigRMCIyylsIaCsjecIUwepeMW9vQzIk
         Ky7/JSdlaDnFiV0An5CKQgciReJhRA5pEANRO+P+FWiZ1ATucECyJRemm4JtY0w0PIN6
         ZNAw5s/botha7lpLsEQhDl/1EoN6dgwQoFVnUR/yGNGWtUwl2axb7IUsk1ojJZWJswit
         sEiA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain test-mail.example.com configured 113.38.36.90 as internal address) smtp.mailfrom=html-test-owner@pr.example.com
Return-Path: <html-test-owner@pr.example.com>
Received: from mail.example.com (example.com. [113.38.36.90])
        by mx.google.com with ESMTPS id pj3si13571567pjb.108.2021.10.28.23.26.35
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 28 Oct 2021 23:26:37 -0700 (PDT)
Received-SPF: pass (google.com: domain test-mail.example.com configured 113.38.36.90 as internal address)
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain test-mail.example.com configured 113.38.36.90 as internal address) smtp.mailfrom=html-test-owner@pr.example.com
Received: by mail.example.com (Postfix, from userid 5001) id 124C36002CF; Fri, 29 Oct 2021 15:26:35 +0900 (JST)
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on Shifter
X-Spam-Level: 
X-Spam-Status: No, score=-19.5 required=5.0 tests=ALL_TRUSTED,BAYES_00, DC_PNG_UNO_LARGO,DNS_FROM_AHBL_RHSBL,HTML_MESSAGE,MIME_HTML_ONLY,MURAKAMI autolearn=ham version=3.3.2
Received: from sympa.example.com (unknown [192.168.12.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.example.com (Postfix) with ESMTPS id B000E6002C9; Fri, 29 Oct 2021 15:26:31 +0900 (JST)
Received: from sympa.example.com (localhost [127.0.0.1]) by sympa.example.com (8.15.2/8.15.2/Debian-14~deb10u1) with ESMTP id 19T6QVW9005464; Fri, 29 Oct 2021 15:26:31 +0900
Received: (from sympa@localhost) by sympa.example.com (8.15.2/8.15.2/Submit) id 19T6QVwu005463; Fri, 29 Oct 2021 15:26:31 +0900
X-Authentication-Warning: sympa.example.com: sympa set sender to html-test-owner@pr.example.com using -f
Content-Transfer-Encoding: binary
Content-Type: multipart/related; boundary="_----------=_163548878950826"
MIME-Version: 1.0
Date: Fri, 29 Oct 2021 15:26:29 +0900
From: qulien@example.com
To: html-test@pr.example.com
Message-Id: <sympa.1635488773.5082.300@pr.example.com>
X-Mailer: Sympa 6.2.40
Subject: [html-test] Test 7: Can we get rid of noname attachments?
Reply-To: qulien@example.com
X-Loop: html-test@pr.example.com
X-Sequence: 8
Errors-To: html-test-owner@pr.example.com
Precedence: list
Precedence: bulk
Sender: html-test-request@pr.example.com
X-no-archive: yes
List-Id: <html-test.pr.example.com>
List-Help: <mailto:sympa@pr.example.com?subject=help>
List-Subscribe: <mailto:sympa@pr.example.com?subject=subscribe%20html-test>
List-Unsubscribe: <mailto:sympa@pr.example.com?subject=unsubscribe%20html-test>
List-Post: <mailto:html-test@pr.example.com>
List-Owner: <mailto:html-test-request@pr.example.com>
List-Archive: <http://sympa.example.com/wws/arc/html-test>
Archived-At: <http://sympa.example.com/wws/arcsearch_id/html-test/2021-10/sympa.1635488773.5082.300%40pr.example.com>

--_----------=_163548878950826
Content-Transfer-Encoding: 7BIT
Content-Type: text/html; charset="US-ASCII"
Date: Fri, 29 Oct 2021 15:26:29 +0900
MIME-Version: 1.0
Content-length: 5047

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="x-apple-disable-message-reformatting">
    <title></title>
    <!--[if mso]>
    <noscript>
        <xml>
            <o:OfficeDocumentSettings>
                <o:PixelsPerInch>96</o:PixelsPerInch>
            </o:OfficeDocumentSettings>
        </xml>
    </noscript>
    <![endif]-->
</head>
<body style="margin:0;padding:0;font-family: Arial, Helvetica, sans-serif;">
    <table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background-color:#f8d8b8;background-image:url('https://dev.example.com/wp-content/uploads/2021/10/bg.jpg');background-size:100%;background-size:cover;">
        <tr>
            <td align="center" style="padding:0;">
                <table role="presentation" style="max-width:600px;text-align:left;border-collapse:collapse;border:0;border-spacing:0;">
                    <tr>
                        <td align="center" style="padding:8px;">
                            <img  src="cid:75706c6f6164732f323032312f31302f7474635f6c6f676f2e706e67@MIME-Lite-HTML-1.24" alt="The Logo" style="display: block;max-width: 100%;margin: 8px 0;">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div style="margin: 8px 0;padding: 8px 16px;color:#222;background-color: #f8e8e8;border: 1px solid #ddd;border-radius: 7px;box-shadow: 0 0 8px #999;">
                                <h2 style="margin: 8px 0 16px 0;text-align: center;font-size: 32px;font-weight: bold;">News from the List</h2>
                                <p style="margin: 8px 0;">Vestibulum quis lorem non eros volutpat semper. Donec semper tincidunt placerat. Pellentesque scelerisque et ipsum quis hendrerit. Duis consectetur nec massa a ultrices. Maecenas et lorem velit. Vestibulum fringilla efficitur felis, et pellentesque urna viverra ac. Phasellus ultrices fringilla enim, et pharetra magna placerat id. In eget felis sollicitudin, consectetur justo fermentum, viverra nulla. Donec sed orci dui. Integer a leo ac ipsum auctor mollis. Praesent scelerisque hendrerit posuere. Duis viverra mauris non ex vulputate, sit amet luctus erat lobortis.</p>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div style="margin: 8px 0;padding: 8px 16px;color:#222;background-color: #f8e8e8;border: 1px solid #ddd;border-radius: 7px;box-shadow: 0 0 8px #999;">
                                <h3 style="margin: 8px 0 16px 0;text-align: center;font-size: 24px;font-weight: bold;">New Items, new Comradery</h3>
                                <img  src="cid:5706c6f6164732f323032312f31302f7474635f74657374312e6a7067@MIME-Lite-HTML-1.24" alt="Description of the image" style="display: block;max-width: 100%;margin: 16px 0;border-radius: 3px;">
                                <p style="margin: 8px 0;">Vestibulum quis lorem non eros volutpat semper. Donec semper tincidunt placerat. Pellentesque scelerisque et ipsum quis hendrerit. Duis consectetur nec massa a ultrices. Maecenas et lorem velit. Vestibulum fringilla efficitur felis, et pellentesque urna viverra ac. Phasellus ultrices fringilla enim, et pharetra magna placerat id. In eget felis sollicitudin, consectetur justo fermentum, viverra nulla. Donec sed orci dui. Integer a leo ac ipsum auctor mollis. Praesent scelerisque hendrerit posuere. Duis viverra mauris non ex vulputate, sit amet luctus erat lobortis.</p>
                                <span style="display: block;text-align: center;"><a href="https://example.com" style="display: inline-block;padding: 12px 16px;margin: 8px 0;color: #fff;text-decoration: none;background-color: #981818;border: 4px solid #fff;border-radius:3px;box-shadow: 0 0 4px #999;">Read more...</a></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div style="margin: 8px 0;padding: 8px 16px;color:#222;background-color: #f8e8e8;border: 1px solid #ddd;border-radius: 7px;box-shadow: 0 0 8px #999;">
                                <h3 style="margin: 8px 0 16px 0;text-align: center;font-size: 24px;font-weight: bold;">New Items, new Comradery</h3>
                                <img  src="cid:5706c6f6164732f323032312f31302f7474635f74657374322e6a7067@MIME-Lite-HTML-1.24" alt="Description of the image"  style="display: block;max-width: 100%;margin: 16px 0;border-radius: 3px;">
                                <p style="margin: 8px 0;">Morbi tempus est at quam rutrum, eleifend posuere quam tincidunt. Aenean faucibus suscipit vehicula. Nullam posuere cursus placerat. Morbi ornare non justo quis sollicitudin. Vivamus pretium vitae orci vel pretium. Quisque egestas pretium gravida. Donec eget posuere nulla. Proin a quam accumsan, lacinia dui id, commodo nisi. Curabitur at eleifend est. Proin mattis sem in ex pharetra, id iaculis justo vestibulum. Suspendisse aliquet est quis condimentum iaculis.</p>
                                <span style="display: block;text-align: center;"><a href="https://example.com" style="display: inline-block;padding: 12px 16px;margin: 8px 0;color: #fff;text-decoration: none;background-color: #981818;border: 4px solid #fff;border-radius:3px;box-shadow: 0 0 4px #999;">Read more...</a></span>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>

--_----------=_163548878950826
Content-Id: <75706c6f6164732f323032312f31302f7474635f6c6f676f2e706e67@MIME-Lite-HTML-1.24>
Content-Transfer-Encoding: base64
Content-Type: image/png
Date: Fri, 29 Oct 2021 15:26:29 +0900
Content-length: 27255

--_----------=_163548878950826
Content-Id: <5706c6f6164732f323032312f31302f7474635f74657374312e6a7067@MIME-Lite-HTML-1.24>
Content-Transfer-Encoding: base64
Content-Type: image/jpg
Date: Fri, 29 Oct 2021 15:26:29 +0900
Content-length: 46470

--_----------=_163548878950826
Content-Id: <5706c6f6164732f323032312f31302f7474635f74657374322e6a7067@MIME-Lite-HTML-1.24>
Content-Transfer-Encoding: base64
Content-Type: image/jpg
Date: Fri, 29 Oct 2021 15:26:29 +0900
Content-length: 45222

--_----------=_163548878950826--

Note that in the original, uploaded HTML file, the <img>'s src are URLs to pictures hosted on https://dev.example.com.

ikedas commented 2 years ago

When I opened the message above using my Gmail account, I could reproduce the problem you described: "noname" attachments were shown.

However, you may have removed contents of image parts from the message above, so I added dummy data as below.

...

</body>
</html>

--_----------=_163548878950826
Content-Id: <75706c6f6164732f323032312f31302f7474635f6c6f676f2e706e67@MIME-Lite-HTML-1.24>
Content-Transfer-Encoding: base64
Content-Type: image/png
Date: Fri, 29 Oct 2021 15:26:29 +0900
Content-length: 27255

XXX

--_----------=_163548878950826

...

Then the problem was solved: There are no more "noname" attachments.

racke commented 2 years ago

I can confirm that I see that behaviour with Gmail and Kmail (Android App).

@ikedas I can send you a sample as PM.

ikedas commented 2 years ago

@ikedas I can send you a sample as PM.

Please!

ikedas commented 2 years ago

@racke thanks. I could reproduce this problem with Gmail.

However, these didn't reproduce: