Hi!

I want to test inside my program if a domain does exist. I am not interested
in the particular domain entries, only in its existence.

For that I tried the following, but it returns always false:

---------------------------------------------------------------
function TestDomain: boolean;
var
   s        :  shortstring;
   sd       :  PChar;
   pn       :  pNetEnt;

begin
   TestDomain:=false;
   DomainFound:=false;

   if pos('@',MailFrom)=0 then exit;    // There cannot be any domain

   s:=Trim(MailFrom); delete(s,1,pos('@',MailFrom));
   if s='' then exit;                   // There's still no domain

   s:=s+#0; sd:[EMAIL PROTECTED];                       // convert to pChar
   pn:=GetNetByName(sd);                // Lookup

   if pn<>nil then                      // if not nil, there was an answer.
   begin
      TestDomain:=True;
      DomainFound:=true;
   end;
end;
---------------------------------------------------------------



What am I doing wrong?





mfg

  Ing. Rainer Hantsch



_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to