Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/delthas/go-messagefix
Fix broken email/RFC822 messages on-the-fly!
https://github.com/delthas/go-messagefix
email eml rfc822
Last synced: 2 days ago
JSON representation
Fix broken email/RFC822 messages on-the-fly!
- Host: GitHub
- URL: https://github.com/delthas/go-messagefix
- Owner: delthas
- License: mit
- Created: 2022-05-05T22:53:00.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-05T22:53:21.000Z (over 2 years ago)
- Last Synced: 2024-06-20T06:25:58.340Z (5 months ago)
- Topics: email, eml, rfc822
- Language: Go
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-messagefix
```shell
go get github.com/delthas/go-messagefix
```go-messagefix offers an io.Reader that transforms RFC822 messages (.EML file contents) on-the-fly from another io.Reader.
The message is slightly transformed/fixed if it breaks the RFC822 spec so that strict implementations may accept it.These transformations are best-effort heuristics and can include:
- closing any multiparts that are still open at EOF
- correctly indenting continuation headers that were not indented## Example
```go
message := `Foo: Bar
Broken-Header:
"This_header_is_broken"
Content-Type: text/plainData
`
r := strings.NewReader(message)
fix := messagefix.NewReader(r)
io.Copy(os.Stdout, fix)
```This prints:
```
Foo: Bar
Broken-Header:
"This_header_is_broken"
Content-Type: text/plainData
```The header continuation is properly indented.
## License
MIT