DusanKasan / parsemail

Simple email parsing for Golang
MIT License
212 stars 138 forks source link

Reading attachements reads nothing #43

Open Jomy10 opened 1 year ago

Jomy10 commented 1 year ago

When I try to read an attachement, there are no bytes returned

var content []byte
size, err := attachement.Data.Read(content)
// size = 0

The email roughly looks like this:

Content-Type: multipart/mixed; boundary="000000000000f229a405f393ef1b"
<!-- ... -->

--000000000000f229a405f393ef1b
Content-Type: multipart/alternative; boundary="000000000000f229a105f393ef19"

--000000000000f229a105f393ef19
Content-Type: text/plain; charset="UTF-8"

<!-- ... -->

--000000000000f229a105f393ef19
Content-Type: text/html; charset="UTF-8"

<!-- ... -->

--000000000000f229a105f393ef19--
--000000000000f229a405f393ef1b
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document;
        name="bondsstaf 27_01_2023 JULIE.docx"
Content-Disposition: attachment; filename="bondsstaf 27_01_2023 JULIE.docx"
Content-Transfer-Encoding: base64
Content-ID: <f_ldkltcqk0>
X-Attachment-Id: f_ldkltcqk0

<!-- attachement in base64 ... -->
--000000000000f229a405f393ef1b--
xhit commented 1 year ago

Try https://github.com/OfimaticSRL/parsemail