Creating an Email Client with Borland Delphi
(Page 1 of 4 )
If you have ever wanted to send email messages from your Delphi application, this article is for you. Jacques Noah explains how to use the open source Indy suite to set up an full fledged Mail Client.
A downloadable zip of the source code is available here.
Introduction
There are many ways to send email messages from your Delphi application; for example, you can use shellexecute by declaring ShellApi in your uses list, or you can simply use Delphi's built in support for Windows Simple Mail Api, but this requires MS Outlook to be installed both on your computer and that of the recipient. The other downside to this is that you will not be able to send attachments, so neither of these options are ideal.
Another approach is to use Indy. Indy is a group of Internet components that comprises all popular Internet protocols, such as POP3, HTTP, ICMP, and so on. Although there are lots of other free Internet component suites available, most of them do not have the standard of quality that you find in the Indy components. The only problem I find with Indy components is that there is not enough support available on their usage. This is mainly because Indy is an open source project and the development of demos to demonstrate how to use the components is very slow.
A recent major change, which brought about Indy 10, was made for the Dot Net Framework and as this is the latest version, appropriate for both the Dot Net and Win32 platforms, it is suffering from a severe lack of demos. I am therefore writing this tutorial to show how to use some of the components available in the latest version of Indy. Despite these problems, Indy components remain popular among Delphi developers and are by far the easiest and most efficient way to write Internet related applications.
To start with, we are going to create an email application that is going to provide us with a basis for building a full fledged Mail Client. A mail client has two primary roles: one, to receive messages and two, to send messages. We will be focussing on sending messages. This application will be able to send messages, both with and without attachments, and will also give us a way to ascertain whether the message has been delivered to the recipient. For those of you who cannot afford Microsoft's Outlook Express or who want their own Mail Client that will do exactly what you want it to do, please read on.
Requirements for this Application:
- We want the application to send messages
(obviously!). - We want it to be able to send attachments
(both single and multiple). - We want confirmation of receipt and delivery (confirmation message should be send to your email address).
Next: What you need >>
More Delphi-Kylix Articles
More By Jacques Noah