Day : Feb,18, 2013
(POP3) Send & Receive E-mails from E-mail server using VB .net Update #3.
- Today's update is about :
Retrieving list of E-mails from your [Inbox] into a [ListBox] control.
Disconnecting from the POP3 server.
Downloading E-mails from POP3 server to your application and read them.
Solving the POP3 connect\disconnect without errors.
Dressing up the application to take it to the next level.
- Point of view
The previous update we have successfully managed to get the number of E-mails from the POP3 server from your Inbox, today we will actually see these e-mails being downloaded from the server into your application and read them.
is that in Gmail.com we will retrieve all E-mails from Inbox and all other folders so if you have (22) E-mails in Inbox and (20) in SentBox and (50) in Trash then we will be getting (22+20+50) = 92 E-mails and we won't be able to tell which one is in which Box, but we will come to this later in our project.
Also the E-mails downloaded will be in absolute Text format, so there will be no links or images displayed at the moment, but we will come to this also later.
- New Design
Applying to the previous code update (2), we will add a [Button : Button2] called [Exit Application] and a [ListBox : ListBox1] and a [Label : Label7] called [Server Response] and another [ListBox : ListBox2] and a [Button : Button1] called [Get E-mails List] and a [TextBox : TextBox1] and a [Label : Label6] called [Read E-mail], and all is clearly obivious in the photo below :
- How does it work now ?
- Before I start let me tell you that :
Logout button is [Enabled=False]
from properties panel.
TextBox1 for reading E-mails is [ReadOnly=True] and [MultiLine=True]
from properties panel.
- Now, it goes like this :
Ctrl+F5 The application starts up you will find Logout button is disabled so you can not logout before you Login
You click on Login Button, if the info provided are successful then you will receive 3 lines in Server Response ListBox1 as shown in the Photo above.
You will then notice that Login Button is disabled and the Logout Button is now enabled.
If you choosed to click on Logout Button now you will notice that a 4th line is added to the Server Response ListBox1 [+OK Farewell] and it means that you are now disconnected from the POP3 server.
Clicking now on Get E-mails List [Button1] will make the application busy retrieving your E-mails into The ListBox2 and you will be able to see the scrollBar shrinking as a sign of retrieving the Messages.
After the List of messages successfully fills the [ListBox2] you can now DoubleClick on any number of this list to read this E-mail in the TextBox1 as absolute Text format which we will be handling it later to be more user friendly.
Clicking on Logout [CmdClose] again will disconnect the server and empty all controls except your loggin settings and disable the Logout Button [CmdClose] and enables the Login Button [CmdDownload] again to start over.
- New Code
Note that will the actual same settings as mine only you can copy and paste this code to your application project instead of codes in coding area.
All Rights Reserved to the Developer evry1falls