Search VB 2010

Monday, August 13, 2012

I was always thinking if i could send and receive e-mails using .Net technology, i was shocked to know that .Net 4 has no POP3 class so one could receive e-mails just like in Microsoft Outlook, regardless that Outlook uses POP3, IMAP and SMTP to both send and receive e-mails from e-mail servers.

I was able to finish the send E-mail part successfully, though i've not finished the attachment and the Html parts, but the receiving e-mails part still out there somewhere i did not do it, though i managed to connect to pop3 servers and receive the +OK response successfully.

I'm using an old laptop (WinXpSp3 Home Edition) with VS2010 along with all the .Net kits installed. I've search the internet for pop3-vb.net resources and i could not land on something that works 100% with the receive E-mails part although i ran into some C# codes that helped me to take the first step which is the Response from the server (Gmail.com).

Another thing to tell you, is Gmail.com have 2-Step Verification method that if enabled, enables you to protect you Google account and provide you with a password to work with applications like this one (E-mail Client). If you dealt with Outlook before you should already knew that; you use your Application password to login to your Gmail.com account associated with your Google account, here is a link that explains all of the 2-Step Verification method, if you don't have a Gmail.com or not working through 2-Step Verification method then you must ignore this.

Also you have to know all about incoming and outgoing Ports, Server and of course User Name and Password, and remember to always use the full e-mail address (your_username@emailserver.com) not just your username, here is some info about E-mail server settings:

Hotmail Settings

Incoming Server(pop3.live.com) port(995) Secure Connection (SSL) is a must

Outgoing Server(smtp.live.com) port(587) Secure Connection (TLS) is a must

Note that Hotmail.com have both free and paid accounts, but both supports E-mail clients. So you should go inside your E-mail settings to enable POP3 and forwarding option to be able to work with E-mail clients.

Yahoo Settings

Incoming Server(pop.mail.yahoo.com) port(995) Secure Connection (SSL) is not a must if you're using the free mail.

Outgoing Server(smtp.mail.yahoo.com) port(465) Secure Connection (TLS) is a must

Note that Yahoo.com have both free and paid accounts, but both supports E-mail clients. So you should go inside your E-mail settings to enable POP3 and forwarding option to be able to work with E-mail clients.

Gmail Settings

Incoming Server(pop.gmail.com) port(995) Secure Connection (SSL) is a must

Outgoing Server(smtp.gmail.com) port(587) Secure Connection (TLS) is a must

Finally, i would really like to suggest using Outlook as a practise first, try to establish a connection with your mail server and send some e-mail and receive some, just to make sure your mail server is sat up correctly.

The Send E-mail Part

Imports System.Net.Mail'The Mail Class we use to send e-mailsPublic Class SendFrm 'The form name : SendFrm Dim SmtpSvr As New Net.Mail.SmtpClient()Dim E_mail As New Net.Mail.MailMessage()Dim UsrNm, Pwd, Srve As StringDim Int_port As Integer

Update (1) Aug,15,2012- I was able to successfully get response from Gmail (pop.gmail.com) server and pass my Username and password.Update (2) Aug,17,2012 - Retrieving the number of E-mails from POP3 Mail Server .Update (3) Aug,18,2012- Get list of E-mails and download them and read them to your application.♥ Here are some online Visual Basic lessons and courses :