Skip to content

Commit 7ddbfba

Browse files
committed
docs: update README for v0.1.1
1 parent 8f487cb commit 7ddbfba

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

README.md

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
# Letters, an email parsing package for go
1+
# Letters
2+
an email parsing package for go
23

34
This is a fork of [mnako/letters](https://github.com/mnako/letters), a
4-
minimalistic Golang library for parsing plaintext and MIME emails.
5+
minimalistic Golang library for parsing plain and MIME emails. Thanks to
6+
@mnako and contributors, letters has great support for languages other
7+
than English, text and transfer encodings.
58

6-
Thanks to @mnako and contributors, letters has great support for
7-
languages other than English, text encodings and transfer-encodings.
9+
This fork (forked at
10+
["db1b793c8119d8ed3d575f44df4391262829d1a5"](https://github.com/mnako/letters/commit/db1b793c8119d8ed3d575f44df4391262829d1a5)
11+
version v0.2.3) focuses on extensibility through modularisation as set
12+
out in [PR #124](https://github.com/mnako/letters/pull/124). This
13+
library also provides improved performance and customisation through
14+
user-defined funcs, for example for efficient attachment processing.
815

9-
This fork focuses on performance, memory efficiency and extensibility
10-
through modularisation.
16+
Future plans include making parsing errors, such as for invalid email
17+
addresses, optionally non-fatal.
18+
19+
github.com/rorycl/letters v0.1.1 10 February 2025
1120

1221
## Quickstart
1322

@@ -132,19 +141,34 @@ parsedEmail, err := p.Parse(reader)
132141
Various options are provided for customising the Parser, including:
133142

134143
```go
144+
// skip content types
145+
func WithSkipContentTypes(skipContentTypes []string) Opt
146+
// provide a custom address processing function
135147
func WithCustomAddressFunc(af func(string) (*mail.Address, error)) Opt
148+
// provide a custom processing function for string lists of addresses
136149
func WithCustomAddressesFunc(af func(list string) ([]*mail.Address, error)) Opt
150+
// provide a custom date processing function
137151
func WithCustomDateFunc(df func(string) (time.Time, error)) Opt
152+
// provide a custom file processing function
138153
func WithCustomFileFunc(ff func(*email.File) error) Opt
154+
// save files to the stated directory (an example of WithCustomFileFunc)
139155
func WithSaveFilesToDirectory(dir string) Opt
156+
// only process headers
140157
func WithHeadersOnly() Opt
158+
// skip processing attachments
141159
func WithoutAttachments() Opt
160+
// show verbose processing info (currently a noop)
142161
func WithVerbose() Opt
143162
```
144163

164+
More than one option can be supplied.
165+
145166
The `WithoutAttachments` and `WithHeadersOnly` options determine if only part
146167
of an email will be processed.
147168

169+
The `WithSkipContentTypes` allows the user to skip processing MIME
170+
message parts with the supplied content-types.
171+
148172
The date and address "With" options allow the provision of custom funcs to
149173
override the `net/mail` funcs normally used. For example it might be necessary
150174
to extend the date parsing capabilities to deal with poorly formatted date
@@ -169,4 +193,3 @@ if err != nil {
169193
return fmt.Errorf("error while parsing email headers: %s", err)
170194
}
171195
```
172-

0 commit comments

Comments
 (0)