Documentation
¶
Overview ¶
Package header has structs and functions handling with mail header and their modifications
Index ¶
- Constants
- func Diff(orig *Header, changed *Header) (changeInsertOps []Op, addOps []Op)
- func DiffOrRecreate(recreate bool, orig *Header, changed *Header) (changeInsertOps []Op, addOps []Op)
- func Recreate(orig *Header, changed *Header) (changeInsertOps []Op, addOps []Op)
- type Field
- type Fields
- func (f *Fields) AddressList() ([]*mail.Address, error)
- func (f *Fields) CanonicalKey() string
- func (f *Fields) Del()
- func (f *Fields) InsertAddressListAfter(key string, value []*mail.Address)
- func (f *Fields) InsertAddressListBefore(key string, value []*mail.Address)
- func (f *Fields) InsertAfter(key string, value string)
- func (f *Fields) InsertBefore(key string, value string)
- func (f *Fields) InsertTextAfter(key string, value string)
- func (f *Fields) InsertTextBefore(key string, value string)
- func (f *Fields) IsDeleted() bool
- func (f *Fields) Key() string
- func (f *Fields) Len() int
- func (f *Fields) Next() bool
- func (f *Fields) Raw() []byte
- func (f *Fields) Replace(key string, value string)
- func (f *Fields) ReplaceAddressList(key string, value []*mail.Address)
- func (f *Fields) ReplaceText(key string, value string)
- func (f *Fields) Set(value string)
- func (f *Fields) SetAddressList(value []*mail.Address)
- func (f *Fields) SetText(value string)
- func (f *Fields) Text() (string, error)
- func (f *Fields) UnfoldedValue() string
- func (f *Fields) Value() string
- type Header
- func (h *Header) Add(key string, value string)
- func (h *Header) AddRaw(key string, raw []byte)
- func (h *Header) AddressList(key string) ([]*mail.Address, error)
- func (h *Header) Copy() *Header
- func (h *Header) Date() (time.Time, error)
- func (h *Header) Fields() header.Fields
- func (h *Header) Reader() io.Reader
- func (h *Header) Set(key string, value string)
- func (h *Header) SetAddressList(key string, addresses []*mail.Address)
- func (h *Header) SetDate(value time.Time)
- func (h *Header) SetSubject(value string)
- func (h *Header) SetText(key string, value string)
- func (h *Header) Subject() (string, error)
- func (h *Header) Text(key string) (string, error)
- func (h *Header) UnfoldedValue(key string) string
- func (h *Header) Value(key string) string
- type Op
Constants ¶
const ( KindEqual = iota KindChange KindInsert )
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
Diff finds differences between orig and changed. The differences are expressed as change and insert operations – to be mapped to milter modification actions. Deletions are changes to an empty value.
Types ¶
type Field ¶
func (*Field) UnfoldedValue ¶ added in v0.8.1
type Fields ¶
type Fields struct {
// contains filtered or unexported fields
}
func (*Fields) CanonicalKey ¶
func (*Fields) InsertAddressListAfter ¶
func (*Fields) InsertAddressListBefore ¶
func (*Fields) InsertAfter ¶
func (*Fields) InsertBefore ¶
func (*Fields) InsertTextAfter ¶
func (*Fields) InsertTextBefore ¶
func (*Fields) IsDeleted ¶
IsDeleted returns true when a previous header modification deleted this header. You can "undelete" the header by just calling [HeaderFields.Set] with a non-empty value.
func (*Fields) Len ¶
Len returns the number of fields in the header. This also includes deleted headers fields. Initially no fields are deleted so Len returns the actual number of header fields.
func (*Fields) ReplaceAddressList ¶
func (*Fields) ReplaceText ¶
func (*Fields) SetAddressList ¶
func (*Fields) UnfoldedValue ¶ added in v0.8.1
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
func (*Header) SetAddressList ¶
func (*Header) SetDate ¶
SetDate sets the Date header to the value. The zero value of time.Time as valid. This will delete the Date header when it exists.