Skip to content
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

Email decoding issue #348

Closed
D3strukt0r opened this issue Aug 15, 2024 · 6 comments
Closed

Email decoding issue #348

D3strukt0r opened this issue Aug 15, 2024 · 6 comments

Comments

@D3strukt0r
Copy link

D3strukt0r commented Aug 15, 2024

Hello, we have been trying to figure out for hours now if an email we are sending from our backend is sending the email faulty or if it's mailpit display that's broken, and after rigorous testing we figured something is off with mailpit

Here are a working case (any length shorter or equal to this will work)

example-works.eml.txt

image

And an example where anything longer or equal to this length (not sure if this is actually true) will break

example-broken.eml.txt

image

when being sent to any other mailcatcher software or opening in MS Outlook, it is displayed correctly

image

I hope this can help you identify the issue :)

PS: I tested with Mailpit v1.20.1

@axllent
Copy link
Owner

axllent commented Aug 15, 2024

@D3strukt0r I can confirm the decoding issue using your sample messages, and I can also confirm that this is originating "upstream" in the jhillyerd/enmime module (which Mailpit uses to decode messages). I was able to replicate it with a simple test to rule out that it is related in any way to Mailpit (see below).

What I can't confirm is whether it has anything to do with your message encoding / structure (I cannot see any obvious issue). It is very strange how just a slight change causes the issue, so it appears to be a possible issue with jhillyerd/enmime.

main.go

package main

import (
	"bufio"
	"fmt"
	"os"

	"github.com/jhillyerd/enmime"
)

func main() {
	if len(os.Args) != 2 {
		fmt.Printf("usage: %s <message>\n", os.Args[0])
		os.Exit(1)
	}

	file, err := os.Open(path.Clean(os.Args[1]))
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	defer file.Close()

	r := bufio.NewReader(file)

	env, err := enmime.ReadEnvelope(r)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	fmt.Println("## TEXT ##")
	fmt.Println(env.Text)
	fmt.Println("## HTML ##")
	fmt.Println(env.HTML)
}

Working example:

go run . example-works.eml.txt 
## TEXT ##
Loggen Sie sich ein, um die Einladung zu akzeptieren oder geben Sie den folge

Nachricht:
öoöo

## HTML ##
    Loggen Sie sich ein, um die Einladung zu akzeptieren oder geben <br />
    <br />Nachricht:<br />
öoöo<br />

Broken example:

go run . example-broken.eml.txt 
## TEXT ##
Loggen Sie sich ein, um die Einladung zu akzeptieren oder geben Sie den folgen

Nachricht:
öoöo

## HTML ##
    Loggen Sie sich ein, um die Einladung zu akzeptieren oder geben S<br />
    <br />Nachricht:<br />
öoöo<br />

My suggestion would be for you to report the issue to jhillyerd/enmime and hopefully someone there can either confirm (and potentially fix) the issue, or explain why your message is causing this. It may be useful to reference this issue to save them time.

@axllent
Copy link
Owner

axllent commented Aug 21, 2024

I can confirm that I get the correct decoding using the default Go library, so I am almost 100% certain it's an upstream (enmime) issue. I will continue to investigate and see if I can find a workaround as I'm not entirely sure a fix will come any time soon.

@axllent
Copy link
Owner

axllent commented Aug 27, 2024

I've found the reason why this happens (commented on in the issue you reported) - will wait for a response to try understand why before I look at a solution (assuming it's not a bug).

@axllent
Copy link
Owner

axllent commented Sep 1, 2024

@D3strukt0r I have just released v1.20.3 which should provide a solution for your issue. Please confirm it is working correctly for you now? Thanks.

@D3strukt0r
Copy link
Author

@axllent yes seems to be working fine for me now :)

image

thank you a lot <3

@axllent
Copy link
Owner

axllent commented Sep 2, 2024

That's fantastic, thank you for the feedback.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this issue Sep 4, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [axllent/mailpit](https://github.com/axllent/mailpit) | patch | `v1.20.2` -> `v1.20.3` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>axllent/mailpit (axllent/mailpit)</summary>

### [`v1.20.3`](https://github.com/axllent/mailpit/blob/HEAD/CHANGELOG.md#v1203)

[Compare Source](axllent/mailpit@v1.20.2...v1.20.3)

##### Chore

-   Update caniemail database
-   Update node dependencies
-   Update Go dependencies
-   Do not recenter selected messages in sidebar on every new message

##### Fix

-   Disable automatic HTML/Text character detection when charset is provided ([#&#8203;348](axllent/mailpit#348))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants