Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to delete a specific email using vb.net windowsforms appllication..
i have source code i want to delete email using this programe.. help me...

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        NotifyIcon1.Visible = True
        Timer1.Enabled = True
        Me.Hide()
        Me.ShowInTaskbar = False
        Left = (SystemInformation.WorkingArea.Size.Width - Size.Width)
        Top = (SystemInformation.WorkingArea.Size.Height - Size.Height)
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.Show()
        If tempCounter >= mailCount Then
            Timer1.Enabled = False
            Me.Hide()
        Else
            lblFrom.Text = "From : " & emailFrom(tempCounter)
            lblMessage.Text = "Subject : " & emailMessages(tempCounter)
            tempCounter += 1
        End If
    End Sub

    Private Sub lblMessage_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblMessage.TextChanged
        If lblMessage.Text = "" Then
        ElseIf lblMessage.Text = "" Then
        ElseIf lblMessage.Text = "" Then
        ElseIf lblMessage.Text = "" Then

        End If
    End Sub
End Class


Module GlobalVariables
    Public emailFrom(1), emailMessages(1) As String
    Public tempCounter As Int16 = 0
    Public mailCount As Int16 = 0
End Module








Imports System.Xml
Imports System.Text
Public Class LoginForm1
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
 
    End Sub

    Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        UsernameTextBox.Text = "madushka.prasad"
        PasswordTextBox.Text = "930400297v"
        Dim objClient As New System.Net.WebClient
        Dim nodelist As XmlNodeList
        Dim node As XmlNode
        Dim response As String
        Dim xmlDoc As New XmlDocument
        Try

            objClient.Credentials = New System.Net.NetworkCredential(UsernameTextBox.Text.Trim, PasswordTextBox.Text.Trim)
            response = Encoding.UTF8.GetString(objClient.DownloadData("https://mail.google.com/mail/feed/atom"))
            response = response.Replace("<feed version=""0.3"" xmlns=""http://purl.org/atom/ns#"">", "<feed>")

            xmlDoc.LoadXml(response)
            node = xmlDoc.SelectSingleNode("/feed/fullcount")
            mailCount = node.InnerText 'Get the number of unread emails

            If mailCount > 0 Then
                ReDim emailFrom(mailCount - 1)
                ReDim emailMessages(mailCount - 1)
                nodelist = xmlDoc.SelectNodes("/feed/entry")
                node = xmlDoc.SelectSingleNode("title")

                For Each node In nodelist
                    emailMessages(tempCounter) = node.ChildNodes.Item(0).InnerText
                    emailFrom(tempCounter) = node.ChildNodes.Item(6).ChildNodes(0).InnerText
                    tempCounter += 1
                Next
                tempCounter = 0
            End If
            Me.Hide()
            Form1.Show()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class
Posted
Updated 16-May-11 22:54pm
v5
Comments
Manfred Rudolf Bihy 17-May-11 5:38am    
Where's the problem?
Any question(s) you want to ask us.
Dave Kreskowiak 17-May-11 8:52am    
Delete an email from what? Your collection of emails? A POP3 server? A remote server of what type??
prasad930400 17-May-11 23:35pm    
i want to delete specific email filter by subject using pop3 server..
prasad930400 17-May-11 23:43pm    
i want to know how to delete email from server using vb.net...

Using the article below, You download the POP3 ID's associated with the email and use that to download / delete from the account

CodeProject Article: Qmail client[^]
 
Share this answer
 
By searching google or any search engine site.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900