https://github.com/teamwork/tnef
Go library to extract body and attachments from TNEF files
https://github.com/teamwork/tnef
go tnef
Last synced: about 1 year ago
JSON representation
Go library to extract body and attachments from TNEF files
- Host: GitHub
- URL: https://github.com/teamwork/tnef
- Owner: Teamwork
- License: mit
- Created: 2016-01-19T16:32:00.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-05-17T16:28:13.000Z (about 3 years ago)
- Last Synced: 2025-04-05T03:22:15.726Z (about 1 year ago)
- Topics: go, tnef
- Language: Go
- Homepage:
- Size: 857 KB
- Stars: 16
- Watchers: 61
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/Teamwork/tnef)
[](https://codecov.io/gh/Teamwork/tnef)
[](https://godoc.org/github.com/Teamwork/tnef)
With this library you can extract the body and attachments from Transport
Neutral Encapsulation Format (TNEF) files.
This work is based on https://github.com/koodaamo/tnefparse and
http://www.freeutils.net/source/jtnef/.
## Example usage
```go
package main
import (
"io/ioutil"
"os"
"github.com/teamwork/tnef"
)
func main() {
t, err := tnef.DecodeFile("./winmail.dat")
if err != nil {
return
}
wd, _ := os.Getwd()
for _, a := range t.Attachments {
ioutil.WriteFile(wd+"/"+a.Title, a.Data, 0777)
}
ioutil.WriteFile(wd+"/bodyHTML.html", t.BodyHTML, 0777)
ioutil.WriteFile(wd+"/bodyPlain.html", t.Body, 0777)
}
```