We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What I did:
package main import ( "strings" "testing" "github.com/jhillyerd/enmime" "github.com/stretchr/testify/require" ) func TestWrongContentTransferEncoding(t *testing.T) { called := false parser := enmime.NewParser( enmime.SetReadPartErrorPolicy(func(p *enmime.Part, err error) bool { called = true return true }), ) email, err := parser.ReadEnvelope(strings.NewReader(EMAIL)) require.NoError(t, err) attachment := email.Attachments[0] t.Logf("Attachment part errors: %d", len(attachment.Errors)) require.True(t, len(attachment.Errors) > 0, "No errors while parsing this part") require.True(t, called, "ReadPartErrorPolicy was not called") } const EMAIL = `From: <> Subject: An email with an attachment Date: Mon, 16 Aug 2021 15:29:07 +0000 Content-Type: multipart/mixed; boundary="outer" MIME-Version: 1.0 --outer Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The message body. --outer Content-Description: attachment.eml Content-Disposition: attachment; filename="attachment.eml"; size=15826; creation-date="Mon, 16 Aug 2021 15:29:04 GMT"; modification-date="Mon, 16 Aug 2021 15:29:04 GMT" Content-Transfer-Encoding: base64 MIME-Version: 1.0 Content-Type: message/rfc822; name="attachment.eml" From: <> Subject: The attached email Date: Mon, 16 Aug 2021 09:32:48 -0400 MIME-Version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: Quoted-printable Content-Disposition: inline Content-Description: Message text The body of the attached email. --outer-- `
What I expected:
I expected the ReadPartErrorPolicy function to be called, where I could hopefully handle the incorrect content transfer encoding.
What I got:
The function was not called.
Release or branch I am using:
1.1.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What I did:
What I expected:
I expected the ReadPartErrorPolicy function to be called, where I could hopefully handle the incorrect content transfer encoding.
What I got:
The function was not called.
Release or branch I am using:
1.1.0
The text was updated successfully, but these errors were encountered: