1. Technology

Extracting the domain (host) name from an e-mail address


If you have an email as a string value and want to extract only the domain (host) name from it, like in: "delphi@aboutguide.com" - domain name = "about.com", you can use the next function:

//extract doman name from an email address
function EmailDomain(const email: string):string;
   Pos_AT : integer;
   Pos_AT := Pos('@', email) ;
   Result := Copy(email, Pos_AT + 1, Length(email) - Pos_AT)

Delphi tips navigator:
» Installing the BDE (manually or using an install program)
« Setting up application wide hot key (keyboard short cut)

Related Video
Link a Website to an Email Address in HTML
Free Up Space in Windows XP

©2014 About.com. All rights reserved.