Skip to content

Magically turn SRV registers into a mail client autoconfiguration file, and serve it.

License

Notifications You must be signed in to change notification settings

bolsote/autoconfig

Repository files navigation

autoconfig.go

Build Status (Unix/Mac) Build Status (Win) Test Coverate Code Quality

This small Go application translates DNS SRV records into an Autoconfiguration file, compatible with a number of email clients. It works for my setup, which means a couple of assumptions:

  • Everything goes through SSL.
  • Password are sent in clear text; if you use SSL, anything else is just overkill.

The code is easy to change if you want something else, though. I just won't support it.

In case your SRV records have multiple entries, the code will just keep the one with the highest priority. A nice thing to have would be multiple server entries. The Autoconfiguration file definition states that, in there are multiple incomingServer or outgoingServer entries, they must appear in order of priority. Since net.LookupSRV() returns all found SRV records sorted by priority, just returning all of them in lookup() and iterating over them (preserving their order) to generate multiple *Server entries would suffice. Since I don't use such a feature, it's not implemented.

For the sake of completeness, let's include a list of possible features. I will get to implement them if I ever use them, or if I feel like playing with this:

  • Multiple servers.
  • Automatically guess SocketType from the port number. It would not work for unconventional setups, but if you have one, I'm sure you can modify the code yourself.
  • Try to open a session to determine the Authentication type. It would also help in trying to guess what goes in Username, although it would produce failed login attemps (careful with software like fail2ban).
  • Maybe, in order to make all this more useful, make some of the *Server fields configurable (such as Username or Authentication), e.g., through a configuration file.

About

Magically turn SRV registers into a mail client autoconfiguration file, and serve it.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages