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 inUsername
, 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 asUsername
orAuthentication
), e.g., through a configuration file.