Skip to content

Instantly share code, notes, and snippets.

@iMega
Created May 18, 2017 12:20
Show Gist options
  • Save iMega/c29d844f57a0e9e88f97f9ddcfc882a0 to your computer and use it in GitHub Desktop.
Save iMega/c29d844f57a0e9e88f97f9ddcfc882a0 to your computer and use it in GitHub Desktop.
package mail
import "time"
type From []Mailbox
type Sender Mailbox
type ReplyTo []Address
type To []Address
type Cc []Address
type Bcc []Address
type Address struct {
Mailbox Mailbox
Group group
}
type Mailbox struct {
NameAddr nameAddr
AddrSpec addrSpec
}
type group struct {
DisplayName string
List []Mailbox
}
type nameAddr struct {
DisplayName string
AngleAddr angleAddr
}
type angleAddr addrSpec
type addrSpec string
type Date time.Time
type Subject string
type Comments string
type Keywords string
func NewNameAddr(DisplayName, AddrSpec string) nameAddr {
return nameAddr{
DisplayName: DisplayName,
AngleAddr: angleAddr(AddrSpec),
}
}
func NewAddrSpec(AddrSpec string) addrSpec {
return addrSpec(AddrSpec)
}
func NewGroup(DisplayName string, m []Mailbox) group {
return group{
DisplayName: DisplayName,
List: m,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment