Skip to content

Broken mails when mail contains attachment #213

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

Open
vjik opened this issue Jun 20, 2024 · 12 comments
Open

Broken mails when mail contains attachment #213

vjik opened this issue Jun 20, 2024 · 12 comments
Assignees
Labels
bug Something isn't working module [Smtp]
Milestone

Comments

@vjik
Copy link

vjik commented Jun 20, 2024

  1. Mail with attachment:
    image

  2. After reload page all mails hidden. Mails list is empty.

@butschster butschster transferred this issue from buggregator/server Jun 20, 2024
@Kreezag
Copy link
Member

Kreezag commented Jun 22, 2024

Hi @vjik!

Unfortunately, this has not been reproduced by me.
I hope this bug is already fixed for the latest frontend release (v 1.19.2).

Monosnap.screencast.2024-06-22.10-12-37.mp4

Could you please share client version and upgrade buggregator version if it is outdated.

The latest version of buggregator you always can find on the demo page: https://buggregator.dev/#demo

If you are already use lates version of client, please share with us your issued event on JSON format

@vjik
Copy link
Author

vjik commented Jun 22, 2024

With txt-files works good, bug appears with PDF attachments.

Versions: v1.10.3, v1.19.2

Error in console:

Kio8Tk7V.js:1 
GET http://127.0.0.1:8000/api/events 500 (Internal Server Error)
getAll @ Kio8Tk7V.js:1
getAll @ Kio8Tk7V.js:1
(anonymous) @ DKhngPU7.js:1
(anonymous) @ YzCi6Sqx.js:14
Ut @ YzCi6Sqx.js:14
nt @ YzCi6Sqx.js:14
t.__weh.t.__weh @ YzCi6Sqx.js:14
Ir @ YzCi6Sqx.js:14
au @ YzCi6Sqx.js:14
Promise.then (async)
ou @ YzCi6Sqx.js:14
Wi @ YzCi6Sqx.js:14
resolve @ YzCi6Sqx.js:14
resolve @ YzCi6Sqx.js:14
(anonymous) @ YzCi6Sqx.js:14
Promise.then (async)
registerDep @ YzCi6Sqx.js:14
se @ YzCi6Sqx.js:14
Z @ YzCi6Sqx.js:14
m @ YzCi6Sqx.js:14
q @ YzCi6Sqx.js:14
run @ YzCi6Sqx.js:10
p.update @ YzCi6Sqx.js:14
$ @ YzCi6Sqx.js:14
se @ YzCi6Sqx.js:14
Z @ YzCi6Sqx.js:14
m @ YzCi6Sqx.js:14
ph @ YzCi6Sqx.js:14
process @ YzCi6Sqx.js:14
m @ YzCi6Sqx.js:14
q @ YzCi6Sqx.js:14
run @ YzCi6Sqx.js:10
p.update @ YzCi6Sqx.js:14
$ @ YzCi6Sqx.js:14
se @ YzCi6Sqx.js:14
Z @ YzCi6Sqx.js:14
m @ YzCi6Sqx.js:14
q @ YzCi6Sqx.js:14
run @ YzCi6Sqx.js:10
p.update @ YzCi6Sqx.js:14
$ @ YzCi6Sqx.js:14
se @ YzCi6Sqx.js:14
Z @ YzCi6Sqx.js:14
m @ YzCi6Sqx.js:14
ph @ YzCi6Sqx.js:14
process @ YzCi6Sqx.js:14
m @ YzCi6Sqx.js:14
q @ YzCi6Sqx.js:14
run @ YzCi6Sqx.js:10
p.update @ YzCi6Sqx.js:14
$ @ YzCi6Sqx.js:14
se @ YzCi6Sqx.js:14
Z @ YzCi6Sqx.js:14
m @ YzCi6Sqx.js:14
K @ YzCi6Sqx.js:14
mount @ YzCi6Sqx.js:14
Up.t.mount @ YzCi6Sqx.js:18
Al @ YzCi6Sqx.js:34
await in Al (async)
(anonymous) @ YzCi6Sqx.js:34
Kio8Tk7V.js:1 getAll err SyntaxError: Unexpected token 'E', "Error code: 500" is not valid JSON

Error in request "http://127.0.0.1:8000/api/events" : Error code: 500

@Kreezag Kreezag transferred this issue from buggregator/frontend Jun 25, 2024
@butschster butschster self-assigned this Jun 25, 2024
@butschster butschster added the bug Something isn't working label Jun 25, 2024
@butschster
Copy link
Member

Undefined array key "subject" in app/modules/Smtp/Application/Mapper/EventTypeMapper.php:16

@butschster butschster added this to the 1.0 milestone Jun 25, 2024
@FluffyDiscord
Copy link
Contributor

FluffyDiscord commented Apr 15, 2025

@butschster please can this be resolved? same issue with the same message ErrorException: Undefined array key "subject" in /app/app/modules/Smtp/Application/Mapper/EventTypeMapper.php at line 16 [] []

Sending email from Symfony 6.4 mailer with subject, 'to', htmlBody and one pdf attachment.

Can I help somehow?

@FluffyDiscord
Copy link
Contributor

FluffyDiscord commented Apr 15, 2025

@butschster Buggregator receives the full payload, the $payload in EventTypeMapper contains everything needed. Anyhow, I did a \serialize($payload) and dumped it on disk to see what buggregator works with, here is anonymized dump:

O:40:"App\Application\Domain\ValueObjects\Json":1:{s:46:"App\Application\Domain\ValueObjects\Jsondata";a:10:{s:2:"id";s:50:"[email protected]";s:4:"from";a:1:{i:0;a:2:{s:5:"email";s:31:"[email protected]";s:4:"name";s:0:"";}}s:8:"reply_to";a:0:{}s:7:"subject";s:16:"Leaderboard";s:2:"to";a:1:{i:0;a:2:{s:4:"name";s:0:"";s:5:"email";s:20:"[email protected]";}}s:2:"cc";a:0:{}s:3:"bcc";a:0:{}s:4:"text";s:0:"";s:4:"html";s:253:" Great job, Niedersächsisches!
Best regards,
team ";s:3:"raw";s:188442:"To: [email protected]
Subject: Leaderboard
Sender: [email protected]
Message-ID: <[email protected]>
From: [email protected]
MIME-Version: 1.0
Date: Tue, 15 Apr 2025 12:27:33 +0200
Content-Type: multipart/mixed; boundary=H7Gml1Xr

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

 Great job, Nieders=C3=A4chsisches!
t regards, team=20
--H7Gml1Xr
Content-Type: application/pdf;
 name="file.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 name="file.pdf";
 filename="file.pdf"

JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvVHlwZSAvUGFnZSAvUGFyZW50IDEgMCBSIC9MYXN0
TW9kaWZpZWQgKEQ6MjAyNTA0MTUxMjI3MzMrMDInMDAnKSAvUmVzb3VyY2VzIDIgMCBSIC9NZWRp
YUJveCBbMC4wMDAwMDAgMC4wMDAwMDAgODQxLjg5MDAwMCA1OTUuMjc2MDAwXSAvQ3JvcEJveCBb
MC4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b7xtdyUY5TTkpeU86iVit5P
yTWtHJhlV7fN2HQtdGsYNwm6d+MwVu2qaWtIbV3VaZvaEeTP8ussw/8Rs9YenXMFszEYZ5iHVA2C
lfhIkbJwCOSKhb9k7aNFmSUP8rIN1nCY8vijGTcgvac7P0/LMa3guBmH3/a5dj8FVz53cl9ab7Co
............

Could it be because the attachment is split to rows and each row seems to end with \r\n ? json_decode fails to parse it?

@butschster
Copy link
Member

Hey! @FluffyDiscord

probably it will be fixed here #277

@FluffyDiscord
Copy link
Contributor

@butschster happy to test if docker image is provided

@FluffyDiscord
Copy link
Contributor

FluffyDiscord commented Apr 16, 2025

@FluffyDiscord
Copy link
Contributor

FluffyDiscord commented Apr 23, 2025

@butschster sorry for the late response, we had holidays - 1.13.4-dev is still broken, same error message about missing "subject".

Would you like a simple repro-repo? I think I can whip up some dummy thingy that will trigger that error later today.

@FluffyDiscord
Copy link
Contributor

@butschster I have made a repro-repo, hopefully it can help you find out what's happening:
https://github.com/FluffyDiscord/buggregator-email-pdf-attachment-repro

From what I can tell, Cycle ORM has issues saving that payload to database. Check this persisted value (row.txt). You can see that the raw key is missing " (double quotes) at the end, thus failing to parse properly when it's returned from database.

Image

I tried navigating Cycle ORM code to find out something myself, but frankly I got lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module [Smtp]
Projects
Status: No status
Development

No branches or pull requests

4 participants