Documentation
¶
Overview ¶
utilities to work on raw message
Index ¶
- Constants
- Variables
- func FoldHeader(header *[]byte)
- func GetHostFromAddress(address string) string
- func RawGetHeaders(raw *[]byte) []byte
- func RawGetMessageId(raw *[]byte) []byte
- func RawHaveHeader(raw *[]byte, header string) bool
- func RedactHeaders(email string) (emailRedacted string)
- func RedactHeadersRemove(email string) (emailRedacted string)
- type Envelope
- type Message
- func (m *Message) AddHeader(key, value string)
- func (m *Message) DelHeader(key string)
- func (m *Message) GetHeader(key string) string
- func (m *Message) GetHeaders(key string) []string
- func (m *Message) GetRaw() (rawMessage []byte, err error)
- func (m *Message) HaveHeader(key string) bool
- func (m *Message) SetHeader(key, value string)
- func (m *Message) SetHeaders(key string, value []string)
Constants ¶
const ( AuthDataStart = "[cocosmail_auth_data=start] " AuthDataEnd = " [cocosmail_auth_data=end]" )
Variables ¶
var ( // ErrNonAsciiCharDetected when an email body does not contain only 7 bits ascii char ErrNonAsciiCharDetected = errors.New("email must contains only 7-bit ASCII characters") )
Functions ¶
func FoldHeader ¶
func FoldHeader(header *[]byte)
FoldHeader retun header value according to RFC 2822 https://tools.ietf.org/html/rfc2822#section-2.1.1 There are two limits that this standard places on the number of characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF. TODO: refactor Foldheader
func GetHostFromAddress ¶
getHostFromAddress returns host part from an email address Warning this check assume to get a valid email address
func RawGetMessageId ¶
RawGetMessageId return Message-ID or empty string if to found
func RawHaveHeader ¶
RawHaveHeader check igf header header is present in raw mail
func RedactHeaders ¶
RedactHeaders removes sensitive information from the email headers once
func RedactHeadersRemove ¶
RedactHeadersRemove removes redaction marks from the email headers once.
Types ¶
type Message ¶
message represents an email message
func (*Message) GetHeader ¶
getHeader get one header, or the first occurence if there is multipke headers with this key
func (*Message) GetHeaders ¶
getHeaders returns all the headers corresponding to the key key
func (*Message) GetRaw ¶
getRaw returns raw message some cleanup are made wrap headers line to 999 char max
func (*Message) HaveHeader ¶
heaveHeader check the existence of header header
func (*Message) SetHeader ¶
Set sets the header entries associated with key to the single element value. It replaces any existing values associated with key.
func (*Message) SetHeaders ¶
SetHeaders sets the header entries associated with key to the multiple element value. It replaces any existing values associated with key.