Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 759
  • Last Modified:

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

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.....
0
jeremy092288
Asked:
jeremy092288
  • 2
1 Solution
 
CodeCruiserCommented:
Here is some code which could be used to download emails from gmail.

http://www.example-code.com/vbdotnet/pop3_gmail.asp
http://www.example-code.com/vbdotnet/email.asp
http://www.a1vbcode.com/snippet-3383.asp
http://www.codeproject.com/KB/IP/QMailClient.aspx
http://www.jscape.com/articles/retrieving_email_pop3_vb.html
http://www.a1vbcode.com/app-3637.asp
' 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 = "pop.gmail.com"
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
    MsgBox(mailman.LastErrorText)
    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.Refresh()
    TextBox1.Text = TextBox1.Text & email.Subject _
         & vbCrLf & vbCrLf
    TextBox1.Refresh()
 
Next

Open in new window

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

Regards,

Matthias
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now