Closed mukul-brevo closed 1 month ago
I tried parsing an eml with Content-Transfer-Encoding: 7bit But seems like only base64 and quoted-printable are supported as per the logic here
Content-Transfer-Encoding: 7bit
base64
quoted-printable
Error
❯ go run . err: failed to parse EML contents: failed to parse EML body parts: failed to parse multipart body: unsupported Content-Transfer-Encoding
Below the snippet i used
func main() { msg, err := gomail.EMLToMsgFromFile("./eml.txt") if err != nil { fmt.Println("err:", err) } files := msg.GetAttachments() for _, file := range files { fmt.Println(file) } }
eml.txt
FCC: imap://piro-test@mail.clear-code.com/Sent X-Identity-Key: id1 X-Account-Key: account1 From: "piro-test@clear-code.com" <piro-test@clear-code.com> Subject: test confirmation To: piro.outsider.reflex+1@gmail.com, piro.outsider.reflex+2@gmail.com, mailmaster@example.com, mailmaster@example.org, webmaster@example.com, webmaster@example.org, webmaster@example.jp, mailmaster@example.jp Message-ID: <05c18622-f2ad-cb77-2ce9-a0bbfc7d7ad0@clear-code.com> Date: Thu, 15 Aug 2019 14:54:37 +0900 X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0; attachmentreminder=0; deliveryformat=4 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Thunderbird/69.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------26A45336F6C6196BD8BBA2A2" Content-Language: en-US This is a multi-part message in MIME format. --------------26A45336F6C6196BD8BBA2A2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit testtest testtest testtest testtest testtest testtest --------------26A45336F6C6196BD8BBA2A2 Content-Type: text/plain; charset=UTF-8; name="sha1hash.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="sha1hash.txt" NzRjOGYwOWRmYTMwZWFjY2ZiMzkyYjEzMjMxNGZjNmI5NzhmMzI1YSAqZmxleC1jb25maXJt LW1haWwuMS4xMC4wLnhwaQpjY2VlNGI0YWE0N2Y1MTNhYmNlMzQyY2UxZTJlYzJmZDk2MDBl MzFiICpmbGV4LWNvbmZpcm0tbWFpbC4xLjExLjAueHBpCjA3MWU5ZTM3OGFkMDE3OWJmYWRi MWJkYzY1MGE0OTQ1NGQyMDRhODMgKmZsZXgtY29uZmlybS1tYWlsLjEuMTIuMC54cGkKOWQ3 YWExNTM0MThlYThmYmM4YmU3YmE2ZjU0Y2U4YTFjYjdlZTQ2OCAqZmxleC1jb25maXJtLW1h aWwuMS45LjkueHBpCjgxNjg1NjNjYjI3NmVhNGY5YTJiNjMwYjlhMjA3ZDkwZmIxMTg1NmUg KmZsZXgtY29uZmlybS1tYWlsLnhwaQo= --------------26A45336F6C6196BD8BBA2A2 Content-Type: application/json; name="manifest.json" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="manifest.json" ewogICJtYW5pZmVzdF92ZXJzaW9uIjogMiwKICAiYXBwbGljYXRpb25zIjogewogICAgImdl Y2tvIjogewogICAgICAiaWQiOiAiZmxleGlibGUtY29uZmlybS1tYWlsQGNsZWFyLWNvZGUu Y29tIiwKICAgICAgInN0cmljdF9taW5fdmVyc2lvbiI6ICI2OC4wIgogICAgfQogIH0sCiAg Im5hbWUiOiAiRmxleCBDb25maXJtIE1haWwiLAogICJkZXNjcmlwdGlvbiI6ICJDb25maXJt IG1haWxhZGRyZXNzIGFuZCBhdHRhY2htZW50cyBiYXNlZCBvbiBmbGV4aWJsZSBydWxlcy4i LAogICJ2ZXJzaW9uIjogIjIuMCIsCgogICJsZWdhY3kiOiB7CiAgICAidHlwZSI6ICJ4dWwi LAogICAgIm9wdGlvbnMiOiB7CiAgICAgICJwYWdlIjogImNocm9tZTovL2NvbmZpcm0tbWFp bC9jb250ZW50L3NldHRpbmcueHVsIiwKICAgICAgIm9wZW5faW5fdGFiIjogdHJ1ZQogICAg fQogIH0KfQ== --------------26A45336F6C6196BD8BBA2A2--
Is there any special reason for it, or are there any plans to add it in future?
No response
Hi @mukul-brevo, thanks for opening the issue. This is an oversight. 7bit is not that commen anymore, and I simply overlooked the posilibty. I'll add support soon.
Is your feature request related to a problem? Please describe.
I tried parsing an eml with
Content-Transfer-Encoding: 7bit
But seems like onlybase64
andquoted-printable
are supported as per the logic hereError
Below the snippet i used
eml.txt
Describe the solution you'd like
Is there any special reason for it, or are there any plans to add it in future?
Describe alternatives you've considered
No response
Additional context
No response