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 retrieve real email addresses from Outlook From Inbox mails. 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
Retrieve real email addresses from Outlook From Inbox mails. 22-Aug-04
Category
OLE
Language
Delphi 4.x
Views
403
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
Godinas-Andrien, Alain
Reference URL:
			1   unit UMain; 
2   
3   interface 
4   //If you are using Delphi 6 or greater replace OutLook_TLB with Outlook2000
5   uses 
6     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
7     ComObj, Outlook_TLB, StdCtrls; 
8   
9   
10  type 
11    TForm1 = class(TForm) 
12      Button1: TButton; 
13      ListBox3: TListBox; 
14      Label1: TLabel; 
15      procedure Button1Click(Sender: TObject); 
16    private 
17      { Private declarations } 
18    public 
19      { Public declarations } 
20  
21    end; 
22  
23  var 
24    Form1: TForm1; 
25  
26  implementation 
27  
28  {$R *.DFM} 
29  
30  procedure TForm1.Button1Click(Sender: TObject); 
31  var 
32      MyOutlook : _Application; 
33      MyNameSpace : _NameSpace; 
34      MyFolder : MAPIFolder; 
35      MyMail, MyReply : _MailItem; 
36      MailRecipients, ReplyRecipients : Recipients; // !! Collection !! 
37      ARecipient : Recipient; // !! Item !! 
38      i, j : Integer; 
39      seMailAddress : string; 
40  begin 
41    MyOutlook := CoOutlookApplication.Create; 
42    try 
43      MyNameSpace := MyOutlook.GetNamespace('MAPI'); 
44      MyFolder := MyNameSpace.GetDefaultFolder(olFolderInbox); 
45      for i := 1 to MyFolder.Items.Count do 
46      begin 
47        MyMail := (MyFolder.Items.Item(i) as _MailItem); 
48        // Comme nous voulons récupérer l'adresse email réelle de l'expéditeur. 
49        // As we want retrieve the real Sender email address. 
50        MyReply := MyMail.Reply; 
51  
52        MailRecipients := MyMail.Recipients; 
53        ReplyRecipients := MyReply.Recipients; 
54        ListBox3.Items.BeginUpdate; 
55        // Récupération de toutes les adresses email réelles des personnes 
56        // en copie. 
57        // Retrieve ALL CC real email addresses. 
58        for j := 1 to MailRecipients.Count do 
59        begin 
60          ARecipient := MailRecipients.Item(j); 
61          seMailAddress := ARecipient.Address; 
62          if Pos('@',seMailAddress) > 0 then 
63            ListBox3.Items.Append(seMailAddress); 
64        end; 
65        // Récupération de l'adresse email réelle de l'expéditeur. 
66        // Retrieve the real Sender email address. 
67        for j := 1 to ReplyRecipients.Count do 
68        begin 
69          ARecipient := ReplyRecipients.Item(j); 
70          seMailAddress := ARecipient.Address; 
71          if Pos('@',seMailAddress) > 0 then 
72            ListBox3.Items.Append(seMailAddress); 
73        end; 
74        ListBox3.Items.EndUpdate; 
75      end; 
76    finally 
77      MyOutlook.Quit; 
78    end; 
79  end; 
80  
81  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