|
Retrieve
E-Mail from a POP3 Server
|
| Your app can easily
retrieve Internet e-mail from a POP3 server once you learn
the tricks... |
|
 |
Building an application to access POP3 mail can be very
difficult without the right help. I have been building POP3
apps for 6 years now and have worked closely with professional
developers the world over -- helping them to do the same. In
this issue of E-Mail Secrets, I am going to show you how to build
a reliable POP3 application the easy way. Developers who are
new to POP3 as well as seasoned POP3 developers will find this
article indispensable. We will cover topics from basic to
advanced and offer tips, tricks and secrets that developers of all
levels can benefit from. What you will learn from this brief
article will save you weeks or more of learning, research and
development. I am confident that you can read this article
and have a basic, reliable POP3 application up and running within an
hour.
In this edition you will learn:
-
How to connect to a POP3 server
-
What you need to know about protecting POP3 passwords that are
processed with your application.
-
How to get the total count of messages in the mailbox
-
How to download full messages or headers only
-
How to download messages or headers in small groups to enable
paging capabilities in your app
-
How to delete a message from the server
-
How to parse a downloaded messages and access all message parts,
including attachments, HTML, etc...
-
How to uniquely identify messages on the server
-
How to synchronize your app with a POP3 server and enable it to
work offline
-
How to detect if a message has already been downloaded by your
app
-
5 things you can't do with a POP3 server
-
Bonus: How to store and organize downloaded messages locally
This edition also contains a sample code and applications
including:
-
VB script code demonstrating most POP3 procedures
-
A simple VB6 POP3 client
-
A simple ASP POP3 client
Introduction
There are many reasons why you may want to build an application to retrieve e-mail from a POP3 server. Automated e-mail
processing, inbox notifications and message scanning are some uses
for POP3 applications -- other than building a full blown desktop
or web based POP3 client.
What does it take to write a functional and dependable POP3
application? You need a basic understanding of what POP3 can
and can not do, and you need a good component to provide that
functionality. You will also need a component that can parse
and decode downloaded messages.
The code samples throughout the newsletter are written in VB
Script. I purposely kept them very simple to avoid confusing
you with unnecessary functionality, bells, whistles and other
bulk. We will be using the POP3 and Message components of
the
EasyMail Objects for retrieving and parsing the messages.
In the bonus section we will use the
EasyMail MailStore object to store and manage downloaded
messages on the local hard drive. The
EasyMail Objects are a set of COM objects that will enable
your application to send, retrieve, merge, compose, view, edit,
store and print Internet e-mail messages. We will only be using a
portion of the
EasyMail Objects
in this issue. To run the samples you will need to download
and install the
EasyMail Objects. The combination of VB
Script and COM components is easy to understand and easily
adaptable to other programming languages or environments such as
Visual Basic, ASP, C++, Delphi, etc... Also available for download are
two sample POP3 client applications. One in Visual Basic and
the other in ASP.
You can download the samples and the EasyMail Objects here.
Lets get started...
Logging In and Getting Message Count
The following example shows how to log into a POP3 server and
get the number of available messages. It uses the
EasyMail
POP3 object to connect to the POP3 server and get the message count:
set objPOP3 = CreateObject("EasyMail.POP3")
objPOP3.MailServer="mail.domain.com"
objPOP3.Account="account"
objPOP3.Password="password"
objPOP3.Connect
cnt = objPOP3.GetDownloadableCount()
MsgBox cnt & " messages available."
objPOP3.Disconnect
Are your POP3 passwords at risk? Continue on to find
out why your passwords may be vulnerable and how to protect
them...
Page Navigator:
1,
2,
3,
4,
5,
Next >>
|
 |
|