Documentation ¶
Index ¶
- Constants
- Variables
- func DiscoverAllImapConfigs(email string) (*[]Config, error)
- type Account
- type AutoConfigResponse
- type Config
- func ConvertAutoDiscoverResponse(config *Response, username string, domain string) (*Config, error)
- func ConvertClientConfigResponse(config *EmailProvider, username string, domain string) (*Config, error)
- func DiscoverImapConfig(email string) (*Config, error)
- func GetAutoConfig(url string, username string, domain string) (*Config, error)
- func GetDomainAutoConfig(username string, domain string) (*Config, error)
- func GetKnownDomainConfig(username string, domain string) (*Config, error)
- func GetMXRecord(domain string, email string) (*Config, error)
- func GetMozillaAutoConfig(username string, domain string) (*Config, error)
- type Documentation
- type DocumentationText
- type EmailProvider
- type ImapDocumentation
- type IncomingServer
- type Protocol
- type Response
Constants ¶
const ( // ProviderGeneric is for generic IMAP providers ProviderGeneric = "GENERIC" // ProviderGMail is for GMail IMAP ProviderGMail = "GMAIL" // ProviderGoogleapps is for google apps (g-suite) IMAP ProviderGoogleapps = "GOOGLEAPPS" // ProviderMicrosoft is for Microsoft IMAP ProviderMicrosoft = "MICROSOFT" // ProviderYahoo is for Yahoo IMAP ProviderYahoo = "YAHOO" // ProviderAOL is for AOL IMAP ProviderAOL = "AOL" // ProviderApple is for Apple IMAP ProviderApple = "APPLE" )
const DomainFormat = "http://autoconfig.%s/mail/config-v1.1.xml?emailaddress=%s"
DomainFormat is the generic domain autoconfig url format
const MozillaFormat = "https://autoconfig.thunderbird.net/v1.1/%s"
MozillaFormat is the mozilla endpoint for domain config
Variables ¶
var AppleDocumentation = []ImapDocumentation{ ImapDocumentation{ Description: "Using app-specific passwords", URL: "https://support.apple.com/en-us/HT204397", }, }
AppleDocumentation are some hard-coded documentation links for apple accounts
Functions ¶
func DiscoverAllImapConfigs ¶
DiscoverAllImapConfigs is an option that tries all of the approaches, returning a list of all successful discoveries.
Types ¶
type Account ¶
type Account struct {
Protocols []Protocol `xml:"Protocol"`
}
Account is part of the AutoDiscover body
type AutoConfigResponse ¶
type AutoConfigResponse struct { EmailProvider *EmailProvider `xml:"emailProvider"` Response *Response `xml:"Response"` }
AutoConfigResponse is a parent struct used for parsing different response formats
type Config ¶
type Config struct { Email string `json:"email"` Username string `json:"username"` Provider string `json:"provider"` Server string `json:"server"` Port int `json:"port"` SSL bool `json:"ssl"` OAuth bool `json:"oauth"` Documentation []ImapDocumentation `json:"documentation"` }
Config represents the IMAP Config response from this service
func ConvertAutoDiscoverResponse ¶
ConvertAutoDiscoverResponse parses the autodiscover response into an ImapConfig.
func ConvertClientConfigResponse ¶
func ConvertClientConfigResponse(config *EmailProvider, username string, domain string) (*Config, error)
ConvertClientConfigResponse parses the client config response into an ImapConfig.
func DiscoverImapConfig ¶
DiscoverImapConfig is the library entrypoint! The options that are more likely to succeed are tried first. In order: Known Domain Configs, Domain Autoconfig endpoints, Mozilla Autoconfig information, and finally MX records for the domain itself
func GetAutoConfig ¶
GetAutoConfig fetches the xml autoconfig info from a given url. It attempts to parse one of two supported formats, Autodiscover and clientConfig.
func GetDomainAutoConfig ¶
GetDomainAutoConfig fetches the domain config information.
func GetKnownDomainConfig ¶
GetKnownDomainConfig returns pre-defined configs for known domains
func GetMXRecord ¶
GetMXRecord checks the MX records of a given domain and returns a config for known records
func GetMozillaAutoConfig ¶
GetMozillaAutoConfig fetches the mozilla default domain config information. https://developer.mozilla.org/en/Thunderbird/Autoconfiguration
type Documentation ¶
type Documentation struct { URL string `xml:"url,attr"` Text []DocumentationText `xml:"descr"` }
Documentation are the documentation links provided by the clientconfig info
type DocumentationText ¶
DocumentationText is the localized text of a Documentation
type EmailProvider ¶
type EmailProvider struct { ID string `xml:"id,attr"` IncomingServers []IncomingServer `xml:"incomingServer"` Documentation []Documentation `xml:"documentation"` }
EmailProvider is the domain clientconfig provider type Response is the other supported domain response.
type ImapDocumentation ¶
ImapDocumentation represents provided documentation
type IncomingServer ¶
type IncomingServer struct { Type string `xml:"type,attr"` Hostname string `xml:"hostname"` Port int `xml:"port"` SocketType string `xml:"socketType"` Username string `xml:"username"` Authentication string `xml:"authentication"` }
IncomingServer contains most of the useful domain clientconfig info