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
Sending an email from Delphi with Outlook 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
24-Aug-02
Category
OLE
Language
Delphi 2.x
Views
81
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

Sending an email from Delphi with Outlook

Answer:

Outlook can be easily controlled through OLE. Try the sample procedure 
SendOutlookMail() from below.

This does not work with Outlook Express.


1   program MailWithOutlook;
2   
3   procedure SendOutlookMail;
4   const
5     olMailItem = 0;
6   var
7     Outlook: OleVariant;
8     vMailItem: variant;
9   begin
10    try
11      Outlook := GetActiveOleObject('Outlook.Application');
12    except
13      Outlook := CreateOleObject('Outlook.Application');
14    end;
15    vMailItem := Outlook.CreateItem(olMailItem);
16    vMailItem.Recipients.Add('dummy@hotmail.com');
17    vMailItem.Subject := 'test email';
18    vMailItem.Body := 'This is a test';
19    vMailItem.Attachments.Add('C:\temp\sample.txt');
20    vMailItem.Send;
21  
22    VarClear(Outlook);
23  end;
24  
25  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