The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

MX record by i_am_pi 2002-10-14 08:27:42
I have a postfix $mydestination line, space delimeted. It contains domains that should be recieved for on this mail server. I want to make sure the MX record matches the proper mail server for every domain.

I have a slight clue on how to but it's needing work, because it barfs that the DNS lookup is undefined.
#!/usr/bin/perl -w
use strict;
use Net::DNS::Resolver;
my $rawdestination = `postconf -h mydestination`;
my @destination = split (" ",$rawdestination);
my $mxrec;
my $res = new Net::DNS::Resolver;
foreach my $domain (@destination)
{
        $mxrec = $res->query($domain,"MX");
        print "MX for $domain is incorrect\n" if $mxrec ne "the.correct.mx";
}
[ Reply ]
  Wait i think i got it.. (n/t) by i_am_pi2002-10-14 08:49:20
    Yep. by i_am_pi2002-10-14 08:58:17
      newimproved version by i_am_pi2006-11-19 12:55:59

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)