Home arrow Delphi-Kylix arrow Page 2 - Creating an Email Client with Borland Delphi
DELPHI-KYLIX

Creating an Email Client with Borland Delphi


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.

Author Info:
By: Jacques Noah
Rating: 5 stars5 stars5 stars5 stars5 stars / 40
October 18, 2005
TABLE OF CONTENTS:
  1. · Creating an Email Client with Borland Delphi
  2. · What you need
  3. · Coding
  4. · Improvements/Remarks

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Creating an Email Client with Borland Delphi - What you need
(Page 2 of 4 )

You need to have Indy 9 or 10 installed. If you have Delphi 6 and above, then you can skip this section; otherwise go to www.indyproject.org and download the version appropriate to your Delphi version. I am using Delphi 7 and Indy 10.0.52. There are proper guides on how to install Indy on your computer.

I'm writing this tutorial on the assumption that you know how to use Delphi. If this is not the case then I would recommend you go to http://delphi.about.com for a beginner's course, before continuing.

Lets' get started!

Start up Delphi and create a new application - File | new | Application. For the purposes of this tutorial I will save the unit as mailer and the project as emailer. You can save it as anything you like. Drop a memo, five edit boxes, five static labels, a list box and two buttons on the form. Call button one "btBrowse" and button two "btMsg". Name the listview as lvAttachments and the five edit boxes as edTo, edFrom, edSubject, edCC, edBC. Call the five static labels From, To, CC, BC and subject. Also add a checkbox, an opendialog and another static label, and name it attachments. Go to the Indy Clients tab and get the idSMTP component, then go to the Indy Misc tab and get the idmessage component, and drop both of them onto the form.

Indy Clients tab:

Indy Misc tab:

Now let me explain what these two components are and what use they are to our application.

IdSMTP: This is basically a component that allows you to connect and communicate with the SMTP Server. To connect to an SMTP Server you need to have a hostname and password. These are usually available from your ISP, unless of course you installed your own SMTP server.

IdMessage: This is a component that will take in all the headers of a message, such as who the message is from, who it is going to, the subject, body, CC and BCC. In other words, all the headers that you see on email messages. In addition, this component also handles the attachment(s) that you will send with your messages.

To summarize:

IdSMTP allows you to connect to the (SMTP) server with the host and password parameters and is also the component that actually sends the message. Without this component the message won't go anywhere. IdMessage component holds all the message headers, including any attachments. IdMessage literally needs to be filled with the message parts.

At this point your application should look something like this:

Next: Coding >>

blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials