mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-19 10:37:01 +00:00
Improved message rendering
Added a decodeSection function to mime.go that uses go-qprintable to parse quoted-printable emails or MIME parts, fixes #7 Added a very basic TextToHtml converter to provide nicer rending of text message bodies.
This commit is contained in:
@@ -42,6 +42,28 @@ func TestParseInlineText(t *testing.T) {
|
||||
assert.Equal(t, mime.Text, "Test of HTML section")
|
||||
}
|
||||
|
||||
func TestParseQuotedPrintable(t *testing.T) {
|
||||
msg := readMessage("quoted-printable.raw")
|
||||
|
||||
mime, err := ParseMIMEBody(msg)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to parse MIME: %v", err)
|
||||
}
|
||||
|
||||
assert.Contains(t, mime.Text, "Phasellus sit amet arcu")
|
||||
}
|
||||
|
||||
func TestParseQuotedPrintableMime(t *testing.T) {
|
||||
msg := readMessage("quoted-printable-mime.raw")
|
||||
|
||||
mime, err := ParseMIMEBody(msg)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to parse MIME: %v", err)
|
||||
}
|
||||
|
||||
assert.Contains(t, mime.Text, "Nullam venenatis ante")
|
||||
}
|
||||
|
||||
func TestParseInlineHtml(t *testing.T) {
|
||||
msg := readMessage("html-mime-inline.raw")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user