I'm pretty sure that you've asked yourself this question, right ?
It's EasyErl here, so let's go to the code directly:
get_mx(Domain) ->
{ok, {hostent, Domain, _, _, _Len, List}} = inet_res:getbyname(Domain, mx),
List.
Woh ! This wasn't too much difficult !
Okay, inet_res:getbyname isn't really well documented that's right, but Erlang comes with its source code, what's a better Erlang documentation than Erlang himself ?
The next time, I'll show you how you can easily sort the List by using unzip to obtain a correct list of MX servers... (where servers weight are correctly used)
1 comment:
Hello,
Your blog is now automatically tracked by http://www.planeterlang.org/
Your post will be slowly added there.
You can register and vote for your favorite articles !
Post a Comment