TEmail: MAPI component (V2.10.0)
TEmail is a non-visual component that allows you to send and receive e-mail
on any Windows 3.x or Windows 95 or Windows NT PC that has MAPI-compatible
e-mail provider software installed.
MAPI is an acronym for Microsoft's "Messaging Application Programming Interface".
Microsoft Mail, Microsoft Exchange, Microsoft Messaging client software, and
Novell GroupWise client software are examples of MAPI providers.
They all supply "Simple MAPI" services via MAPI(32).DLL.
Note: If support for MAPI has not been installed on your system, you will not be
able to test your application that uses TEmail!
You can develop without MAPI support though.
The component will also test the availability of MAPI at runtime.
- Installation Instructions
- Component Description
- History, Authors and Credits
1. Installation instructions :
1. Unzip Temail2.zip to a temporary directory |
2. Copy compon\*.* to your component directory |
3. Installation for
-
Delphi 1: Install email16.pas into your component library
and rebuild the component library.
Add email.kwf to your help system using helpinst.exe and copy
email.hlp to the Delphi \BIN directory.
-
Delphi 2 and C++ Builder 1.0: Install email32.pas into your component library
and rebuild the component library.
Add email.kwf to your help system using helpinst.exe and copy
email.hlp and email.cnt to the respective \BIN directory.
-
Delphi 3: Either install email32.pas into one of your user-defined
packages, or open (File | Open) email3.dpk and press Install.
Copy email.hlp and email.cnt to your Delphi \HELP directory,
open DELPHI3.CFG in \HELP with a text editor and add to the end of this
file the text:
; TEmail Help
;------------
:Link email.hlp
Finally delete DELPHI3.GID.
|
4. From this moment on you can play with the provided demo applications.
You may want to have a look at the FAXDEMO directory, which contains
another demonstration of how to use the component with MAPI Fax support.
Alternatively you can play with the "TEmail" component itself. |
2. Component Description :
Published properties (design-time) :
-
Acknowledge : Boolean : sendmail sets receipt requested
-
Attachment : TStrings with attachment file names
-
CC : TStrings with CC
-
BCC : TStrings with BCC
-
DownLoadFirst : Boolean : MAPI will first get new mail messages before
returning from Logon if set to True. If left False, Logon will return immediately
and new mail will be fetched in background.
-
MAPIAvail : Boolean read-only flag tells if MAPI services are present.
-
NewSession : Boolean to select whether to unconditionally start a new MAPI session.
-
Password : the logon password
-
Profile : the Exchange logon profile (or MSMAIL logon id) defaults to Exchange
DefaultProfile from registry when running on a Win32 system
-
Recipient : TStrings with recipients
-
ShowDialog : lets you use the standard Mail clients editor
-
Subject : Pascal (short)string with subject
-
Text : Pascal (short)string with (short) message body text
-
TruncAttFN : determines whether to truncate the filename of an attachment
-
UnreadOnly : Boolean : retrieves only new messages with GetNextMessageID
-
UseDefProfile : Boolean : lets you use the Exchange default profile (this
also works for a 16bit application running on a 32bit Windows)
Logon profile and password are not needed if you are already logged on.
If you are not logged on, you can leave them blank, a logon dialog
box will pop up.
Public methods :
-
function SetLongText : PChar : sets pointer to long message text
-
function GetLongtext : PChar : gets pointer to long message text
-
function Logon : integer : mapi logon
-
function Logoff : integer : mapi logoff
-
function CheckRecipient : (short)string returns valid recipient
-
function CheckAttachment : (short)string returns valid attachment
-
procedure Clear : invalidate and clear a number of message fields
-
function SendMail : integer : sends mail
-
function SaveMail : integer : saves mail
-
function CountUnread : integer : counts unread messages
-
function GetNextMessageId : (short)string : gets next message id
-
function ReadMail : integer : reads a mail by message id
-
function Address : check all addresses in recipient stringlists allows
user to add addresses with dialog box pop-up
-
function CopyAttachment(index, destination, deleteflag) : integer, copies
a given attachment from it's temp location to a destination pathname optionally
deleting the temporary copy.
-
procedure DownLoad : will get new mail by logging off, setting DownLoadFirst
to True, and loggin on again.
Public properties (runtime) :
-
AttPathNames : TStrings with received attachment temp pathnames if NoAttachments
was False on ReadMail.
-
DateRecvd : (short)string : date received (ReadMail)
-
HeaderOnly : boolean : ReadMail returns "envelope only"
-
LeaveUnread : boolean : ReadMail does not flag read messages "read"
-
MessageId : (short)string : message id for ReadMail and DeleteMail, returned
by GetNextMessageId
-
MessageType : (short)string : message type
-
Originator : (short)string : message originator (readmail)
-
OrigAddress : (short)string, mail address of originator
-
Unread : boolean : message was already marked "read" flag (ReadMail)
-
NoAttachments : boolean : ReadMail does not retrieve attachments If set
False : attachments are copied to a temporary location, you get the temporary
pathnames in the AttPathNames stringlist.
Take care: If you set NoAttachments to false, then .ReadMail will put the
attachments in a temp directory, and you have to delete them yourself,
or call .CopyAttachment with the delete_after_copy flag set to True!
3. History:
More details can be found in the online help.
Original version 1.00.00 : Keith Darragh (c) SWIFTsoft 1995
Version 2.00.00, 2.00.0a, 2.00.0b: Danny
Heijl:
Extended Keith's code sample to a fully functional MAPI component with
demo application:
- MAPI header file moved to a separate "smapi.pas" (simple mapi.pas)
-
adds Acknowledge property (acknowledge receipt)
-
adds CC property (multiple CCs in a stringlist)
-
adds support for multiple recipients (in a stringlist)
-
adds support for multiple attachments (in a stringlist)
-
adds SetLongText/GetLongText methods, in case your message text happens to be
> 255 bytes in size
-
adds CheckRecipient method
-
adds CheckAttachment method
-
adds GetNextMessageId method
-
adds ReadMail method
-
adds 'LeaveUnread' property for ReadMail
-
adds 'NoAttachments' property for ReadMail
-
adds 'HeaderOnly' property for ReadMail
-
adds support for DELPHI 2.0
Version 2.00.0c:
added MAPI "address" dialog
-
added BCC property
-
moved repeated code to an internal procedure "ListToRecipArray"
-
added "profile" and "password" properties
-
added "UseDefProfile" property for Win32 Exchange clients
-
added "pass-thru addressing", ie: [FAX:123456] or [SMTP:xxx@yyy] by-passing
the address book
-
implemented dynamic loading of the MAPI(32).DLL, raises exception if MAPI(32).DLL
is not found
-
added "MAPIAvail" property (read-only)
-
implemented dynamic arrays for recipient/attachment arrays
-
some cosmetic changes
-
enabled "UseDefProfile" property for 16bit applications running on a native
32bit systems (Win95, WinNT)
(this requires the public domain unit Call32NT which is included.
Note: A minor bug has been fixed in this version of Call32NT.
It is very very unlikely that it would materialize, but then...)
-
added a second attempt to load DLLs dynamically (for NT)
-
added property ShowDialog - use the standard MAPI editor for editing
Version 2.02.0a:
-
runtime property "OrigAddress" added
-
Also: minor bugfix for Delphi 16 in the 2.02.00 code (Danny)
Version 2.03.00:
Changes to attachment code suggested by Roman
Popov:
-
added runtime stringlist property with the pathnames of received attachments
-
the pathname of attachments is returned in the attachment property in case
your MAPI implementation does not use the filename member of the mapimessage
structure
-
a new method "CopyAttachment(stringlist_index, destination, deleteaftercopyflag)"
copies an attachment for you.
If you double-click an attachment in the listbox in the demo app you
can try this out.
-
tested with Delphi 3, implemented resource strings.
-
A new enhanced "Demo App", further enhanced by Stefan.
Version 2.04.00:
-
If UseDefProfile = true was used in a 16bit Windows environment, error
messages would be shown, though the component would continue to work. This
has been fixed.
-
Added property UnreadOnly as suggested by Nikolai
Soumarokov - this will only retrieve unread mail.
-
Some changes to the help file and documentation.
-
Added FAX broadcast demo courtesy of Michael
Wilcox. This application demonstrates how to amend a database of address
details and fax a letter to people automatically using MS Exchange.
Version 2.05.00:
-
Implemented new property DownLoadFirst and new procedure Download
on suggestion of Roman Popov
-
Updates to the documentation
Version 2.05.01:
Ulrik Schoth
:
-
The component now uses the correct registry key under Windows NT when "UseDefProfile"
is True
Version 2.06.00:
Stefan Hoffmeister:
-
Integrated code for adding filename information for attachments created
by Michael Kennedy
-
Memory leaks in demo and component fixed
-
Added Borland C++ Builder 1.0 compatibility
-
Updates to the documentation
Version 2.07.00:
Stefan Hoffmeister:
-
Integrated code for SendMail and NewSession written
by Daniel Easton
-
Bug in 2.06.00 thunking code fixed
-
Some internal restructuring, in particular flLogonFlags made protected
-
Changed MAPI detection logic
-
Updates to the documentation
Version 2.08.00:
Stefan Hoffmeister:
-
Fixed a long-standing issue where TEmail could not send mail to recipients where
the name in the address book was not unique (e.g. two entries for "Stefan Hoffmeister")
- Fixes compilation problem with C++ Builder
- Added a public "MessageType" property (Danny).
Version 2.08.01:
Danny Heijl (never published):
- A fix for use of TEmail with the Eudora PRO 3 and 4 MAPI support DLL's, by
Ken Clark
- A new (read-only) "Version" property.
Version 2.09.00 - 2.09.02:
Stefan Hoffmeister:
- Code updated to support Delphi 4 and C++ Builder 3.0
- Updated C++ Builder 1.0 and 3.0 projects, courtesy
of Gerald Patel
- Added C++ Builder 3.0 project files
- Documentation updates
- ...more details can be found in the online documentation.
Version 2.10.0:
Stefan Hoffmeister:
- Fix problem with Outlook Express attachments
- Fix problem with Novell GroupWise 5.2 server
- Documentation updates
- ...more details can be found in the online documentation.
If you have added features
to this component feel free to send them and they will probably be incorporated
into future releases to the benefit of everybody.
Last update: 1 November 1998