mailstrip

package module
v0.0.0-...-e1c70b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2016 License: MIT Imports: 6 Imported by: 0

README

mailstrip

mailstrip is a Go library that parses email text and strips it of signatures and reply quotes. It is a port of email_reply_parser, GitHub's library for parsing email replies.

Differences to email_reply_parser

Most of mailstrip is a line-by-line port of email_reply_parser and it passes all tests from the email_reply_parser test suite. However, it also implements a few improvements that are not part of email_reply_parser:

  • Forwarded fragments are detected and considered to be visible text, see d321c1.
  • Replies from Yahoo! which lack ">" quote indicators are handled correctly, see e844d.
  • Alternative quote headers used by gmail are handled correctly, see 7ecb6

Documentation

The API documentation can be found here: http://godoc.org/github.com/ThomsonReutersEikon/mailstrip

License

MIT License. See LICENSE file.

Documentation

Overview

mailstrip is a Go library that parses email text and strips it of signatures and reply quotes. It is a port of email_reply_parser, GitHub's library for parsing email replies.

see https://github.com/github/email_reply_parser

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email []*Fragment

Email contains the parsed contents of an email.

func Parse

func Parse(text string) Email

Parse parses a plaintext email and returns the results.

Example
text :=
	`Yeah, that works!

-Bob

On 01/03/11 7:07 PM, Alice wrote:
> Hi Bob,
>
> can I push the latest release later tonight?
`

email := Parse(text)
fmt.Printf("result: %q\n", email.String())
Output:
result: "Yeah, that works!"

func (Email) String

func (e Email) String() string

String returns the non-Hidden() fragments of the Email.

type Fragment

type Fragment struct {
	// contains filtered or unexported fields
}

Fragment contains a parsed section of an email.

func (*Fragment) Forwarded

func (f *Fragment) Forwarded() bool

Forwarded returns if the fragment is forwarded or not.

func (*Fragment) Hidden

func (f *Fragment) Hidden() bool

Signature returns if the fragment is considered hidden or not.

func (*Fragment) Quoted

func (f *Fragment) Quoted() bool

Signature returns if the fragment is a quote or not.

func (*Fragment) Signature

func (f *Fragment) Signature() bool

Signature returns if the fragment is a signature or not.

func (*Fragment) String

func (f *Fragment) String() string

String returns the content of the fragment.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL