Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to varify a Email Address Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Varify a Email Address 20-Jul-04
Category
Algorithm
Language
Delphi All Versions
Views
635
User Rating
6
# Votes
3
Replies
0
Publisher:
Darley, F. Joe
Reference URL:
			1   
2   unit Unit1;
3   
4   interface
5   
6   uses
7     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8     Dialogs, StdCtrls;
9   
10  type
11    TForm1 = class(TForm)
12      Button1: TButton;
13      Edit1: TEdit;
14      procedure Button1Click(Sender: TObject);
15    private
16      { Private declarations }
17    public
18    procedure ValidEmail(sEmail:string);
19      { Public declarations }
20    end;
21  
22  var
23    Form1: TForm1;
24  
25  implementation
26  
27  {$R *.dfm}
28  
29  procedure TForm1.Button1Click(Sender: TObject);
30  begin
31   ValidEmail(Edit1.text);
32  end;
33  
34  procedure TForm1.ValidEmail(sEmail: string);
35  var
36  at,dot,i:Integer;
37  bOkay:boolean;
38  sline:string;
39  begin
40  
41      at:=Pos('@',sEmail);
42      dot :=LastDelimiter('.',sEmail);
43      bOkay:=(at>0)and(dot>at);
44  
45  
46   if bOkay then begin
47      for i:=1 to Length(sEmail) do begin
48    if not (sEmail[i] in ['a'..'z','A'..'Z','0'..'9','-','_','.','@']) then begin
49      bOkay:=false;
50      break;
51    end;
52  
53      end
54   end;
55  
56   if not bOkay then
57   Showmessage('Not a valid Email address')
58   else
59   ShowMessage('Valid Address');
60  end;
61  
62  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC