(Delphi DLL) 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, MailMan;
...
procedure TForm1.Button1Click(Sender: TObject);
var
mailman: HCkMailMan;
mxDomain: PWideChar;
begin
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
mailman := CkMailMan_Create();
mxDomain := CkMailMan__mxLookup(mailman,'support@chilkatsoft.com');
if (CkMailMan_getLastMethodSuccess(mailman) <> True) then
begin
Memo1.Lines.Add(CkMailMan__lastErrorText(mailman));
Exit;
end;
Memo1.Lines.Add('MX Domain: ' + mxDomain);
CkMailMan_Dispose(mailman);
end;
|