How can I recieve/download e-mail into my VB.NET 2008 application?

Posted on 2009-05-08
Last Modified: 2013-11-29
I am trying to develop a VB.NET application that responds to a user via text message with their "status" for today. I can get the text message sent, that's not the problem. However when they want to check their status... they send their ID# to an SMS site, which is then forwarded to an e-mail. How can I download those e-mails automatically and use the data in the body? Right now I have them all being forwarded to a Gmail account but I can change that if I have to.....
Question by:jeremy092288
  • 2

Expert Comment

ID: 24343366
LVL 83

Accepted Solution

CodeCruiser earned 250 total points
ID: 24345824
Here is some code which could be used to download emails from gmail.
' The mailman object is used for receiving (POP3)

' and sending (SMTP) email.

Dim mailman As New Chilkat.MailMan()

' Any string argument automatically begins the 30-day trial.

Dim success As Boolean

success = mailman.UnlockComponent("30-day trial")

If (success <> true) Then

    MsgBox("Component unlock failed")

    Exit Sub

End If

' Set the GMail account POP3 properties.

mailman.MailHost = ""

mailman.PopUsername = "****"

mailman.PopPassword = "****"

mailman.PopSsl = true

mailman.MailPort = 995

Dim bundle As Chilkat.EmailBundle

' Read mail headers and one line of the body.

' To get the full emails, call CopyMail instead (no arguments)

bundle = mailman.GetAllHeaders(1)

If (bundle Is Nothing ) Then


    Exit Sub

End If

Dim i As Integer

Dim email As Chilkat.Email

For i = 0 To bundle.MessageCount - 1

    email = bundle.GetEmail(i)

    ' Display the From email address and the subject.

    TextBox1.Text = TextBox1.Text & email.From & vbCrLf


    TextBox1.Text = TextBox1.Text & email.Subject _

         & vbCrLf & vbCrLf



Open in new window


Expert Comment

ID: 24352455
Note that this code only applies if you want to use third party components, which you have to buy.



Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

There was an incident about the POP3 issue for the double read receipts and delivery receipts in Exchange 2013.  There was huge research been done and found solution for the duplicate mails. Especially when the user gets  duplicate mails.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now