(Delphi ActiveX) MX Lookup Mail Server Domain by Email Address
How to find the mail server for a given email address. Returns the domain name of the primary mail server.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
mailman: TChilkatMailMan;
mxDomain: WideString;
begin
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
mailman := TChilkatMailMan.Create(Self);
mxDomain := mailman.MxLookup('support@chilkatsoft.com');
if (mailman.LastMethodSuccess <> 1) then
begin
Memo1.Lines.Add(mailman.LastErrorText);
Exit;
end;
Memo1.Lines.Add('MX Domain: ' + mxDomain);
end;
|