wneessen / go-mail

📧 Easy to use, yet comprehensive library for sending mails with Go
https://go-mail.dev
MIT License
571 stars 44 forks source link

Fixes bug with attachment encoding #38

Closed wneessen closed 2 years ago

wneessen commented 2 years ago

Hopefully addresses #37 too.

By default, the encoding/base64 in Go does not add line breaks to its output. This patch introduces the Base64LineBreaker which satisfies the io.WriteCloser interface. Attachments are now correctly broken up into maximum of 76 chars. This hopefully satisfies the requirements of more strict mail servers, that do not allow lines longer than 78 chars (SHOULD)/998 chars(MUST) - see: https://www.rfc-editor.org/rfc/rfc5322#section-2.1.1

codecov-commenter commented 2 years ago

Codecov Report

Merging #38 (ffa1b47) into main (db2d581) will decrease coverage by 0.56%. The diff coverage is 64.70%.

@@            Coverage Diff             @@
##             main      #38      +/-   ##
==========================================
- Coverage   82.99%   82.43%   -0.57%     
==========================================
  Files          10       11       +1     
  Lines        1094     1127      +33     
==========================================
+ Hits          908      929      +21     
- Misses        131      139       +8     
- Partials       55       59       +4     
Impacted Files Coverage Δ
base64_writer.go 60.00% <60.00%> (ø)
msgwriter.go 90.43% <100.00%> (+0.13%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more