[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Find SMTP server(s): nslookup?



>} >there be a "/etc/resolv.conf", which isn't a real problem, except MacPerl
>} >users don't usually have one.  You have to construct one and point Net::DNS
>} >at it.
>}
>} Not sure what you mean by construct one. You mean that if the user
>}doesn't have a "/etc/resolv.conf" file, I have to tell Net::DNS which DNS
>}to use? Would make sense. Any way to get the info out of the system? If
>}there is, it probably should be part of Net::DNS, actually.
>
>MacOS uses a completely different way of getting the nameserver(s) than
>Unix.  There isn't a file named /etc/resolv.conf lying around, and there's
>no text file with lines "domain this" "nameserver that" that can be used as
>a substitute.  Anyone on MacOS that wants to use Net::DNS has to find out
>what the format of an /etc/resolv.conf and roll their own.  I simply copied
>the one off my Sun workstation and edited it, and then changed
>Net::DNS::Resolver to point to that file.  Chris' experience this morning,
>though, may mean that I didn't have to do this.  I don't remember why I
>did, but I vaguely remember the module throwing up because I didn't have
>one when I tried to use it.

Chris may have a DNS server on his Mac? Net::DNS defaults to 127.0.0.1 if all else fails. Or he may have edited Resolver.pm, or specified the nameservers in the calling script ($res->nameservers("x.x.x.x", "y.y.y.y"). Found all this while re-trying to make it work on Win95. (And eventually patched it, so it gets the info from the registry as for NT).

Quentin suggested this, which sounds promising:

>the way I get the address of the SMTP hostname is this (it uses
>InternetConfig, which has come bundled with the Mac OS since Mac OS 7.6):
>
>use Mac::InternetConfig;
>print $InternetConfig{kICSMTPHost};

If it's that easy, it should be integrated into Net::DNS. Even if it doesn't work on all Macs, it doesn't cost a lot to try...

>If you want to send e-mail, then you can just use Net::SMTP, which is in
>libnet. It automatically gets the data from InternetConfig, including SMTP
>host, SMTP username, SMTP password, and others.

No need for a password for SMTP, but if the user's e-mail address is there too, that's interesting. What would the key be?


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org