Skip to content
pointum edited this page Jan 9, 2016 · 2 revisions

Providers are a part of the MailCore2 framework that allow us to make educated guesses about the basic configurations of the servers of major email providers without having to fetch capabilities. Providers are written in JSON using a regular format, and can even be added by writing a custom JSON file that follows a few rules.

Basic Structure

All providers files begin with a top-level dictionary of the names of the providers themselves mapped to details about that provider. For example, a provider file for a new email company, MailCore, might look like this:

{
    "mailcore-example":{
        "servers":{
            "imap":[
                {
                    "port":993,
                    "hostname":"mail.mailcore.com",
                    "ssl":true
                },
                {
                    "port":143,
                    "hostname":"mail.mailcore.com",
                    "starttls":true
                }
            ],
            "smtp":[
                {
                    "port":587,
                    "hostname":"smtp.mailcore.com",
                    "starttls":true
                }
            ]
        },
        "domain-match":[
            "mailcore\\.com",
            "mailcore2\\.com"
        ],
        "mx":[
            "mx0.mailcore.com",
            "mx1.mailcore.com"
        ],
        "mailboxes":{
            "drafts":"Drafts",
            "allmail":"Archive",
            "spam":"Junk",
            "sentmail":"Sent Messages",
            "trash":"Deleted Messages"
        }
    }
}

Servers

An object that accepts only these keys to arrays: imap, pop and smtp. Server objects consist of three fields port - the port to connect on, hostname - the address of the host server, and either ssl or starttls to indicate the security protocol used on the server.

Hostnames also support additional flexibility through the use of a {domain} placeholder literal. When one is encountered, MailCore will attempt to replace it with the domain of the provided email address. For example:

{
    "port":25,
    "hostname":"mail.{domain}"
}

Domain Matches

A list of regular expressions that will match a provided domain.

MX

An optional array of MX domains.

Mailboxes

A dictionary of keys to the path of standard mailboxes. Valid mailbox keys are:

  • sentmail
  • allmail
  • important
  • drafts
  • spam
  • starred
  • trash