Skip to content
New issue

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

Fixes bug with attachment encoding #38

Merged
merged 2 commits into from
Aug 14, 2022
Merged

Fixes bug with attachment encoding #38

merged 2 commits into from
Aug 14, 2022

Conversation

wneessen
Copy link
Owner

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

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
@codecov-commenter
Copy link

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%) ⬆️

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

@wneessen wneessen merged commit c6fe75f into main Aug 14, 2022
@wneessen wneessen deleted the 37-attachment-length branch August 14, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bounces from multiple providers due to 501 5.5.4 Syntax error in BODY parameter
2 participants