Secure the Email in Your .NET Apps with SSL Email Components
page 12 of 14
by John Alessi
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 49461/ 78

Retrieving Mail with POP3 over an SSL Connection

Retrieving mail over a secure connection is just as easy.  The following example uses the EasyMail .Net Edition POP3 component and Parse component with the SSL plug-in.

VB.Net Sample
Dim objPOP3 As New POP3
Dim objSSL As New SSL
objPOP3.Connect("mail.domain.com",
                995, objSSL.GetInterface())
objPOP3.Login("account", "password", AuthMode.Plain)
Dim memoryStream As New MemoryStream
objPOP3.DownloadMessage(1, memoryStream)
memoryStream.Position = 0
Dim msg As New EmailMessage(memoryStream)
Console.WriteLine(msg.Subject)
Console.ReadLine()
[code]
C# Sample
[code language="C#]
POP3 objPOP3 = new POP3();
SSL objSSL = new SSL();
objPOP3.Connect("mail.domain.com",
                995, objSSL.GetInterface());
objPOP3.Login("account", "password", AuthMode.Plain);
MemoryStream memoryStream = new MemoryStream(); 
objPOP3.DownloadMessage(1,memoryStream);
memoryStream.Position=0; 
EmailMessage msg = new EmailMessage(memoryStream);
Console.WriteLine(msg.Subject);
Console.ReadLine();

 

As you can see securely retrieving email from a POP3 server is very easy too.  It is a very simple sample, but the amount of work going on beneath the hood is extreme.  It demonstrates perfectly how EasyMail .Net Edition shields you from the complexities of SSL, POP3, MIME, parsing and much more.  The sample uses the POP3 component to download the first message in the POP account to a memory stream, then parses it and displays the subject.  Communications with the mail server will take place on port 995 which is the standard port for POP3 data traveling over SSL connections.  The SSL plug-in is interfaced with the POP3 component during the call to Connect().  Even I am wondering "Is that it?".  Yeah that's it.  It is amazing how much EasyMail .Net Edition does for you while at the same time EasyMail .Net Edition will enable experienced developers to control and access virtually every aspect of SSL, POP3 and the parsed message.


View Entire Article

User Comments

Title: NO TEXT WRAP!   
Name: Stuart Welwood
Date: 2006-02-21 2:07:44 PM
Comment:
The text of this article does not wrap - VERY difficult to read!

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-28 5:12:17 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search