Step 1: Create a new project called 'Receiving Emails'
Step 2: Download the attachment and add the .dll as a reference(for public releases bind the .dll file to the .exe)
Step 3: Import the following:
Code:
Imports System.IO
Imports System
Imports EAGetMail 'imports EAGetMail namespace
Step 4: Under Public Class 1 add the following:
Code:
' to save the email retrieved.
Dim curpath As String = Directory.GetCurrentDirectory()
Dim mailbox As String = [String].Format("{0}\inbox", curpath)
Dim r As IO.StreamReader
Step 5: Now on a button click add the following:
Code:
Dim oServer As New MailServer("pop.gmail.com", _
"yourusername@gmail.com", "yourpassword", ServerProtocol.Pop3)
Dim oClient As New MailClient("TryIt")
oServer.SSLConnection = True
oServer.Port = 995
Try
oClien*****nnect(oServer)
Dim infos As MailInfo() = oClient.GetMailInfos()
For i As Integer = 0 To infos.Length - 1
Dim info As MailInfo = infos(i)
Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}", _
info.Index, info.Size, info.UIDL)
'receive email from POP3 server
Dim oMail As Mail = oClient.GetMail(info)
Console.WriteLine("From: {0}", oMail.From.ToString())
Console.WriteLine("Subject: {0}" & vbCr & vbLf, oMail.Subject)
'generate an email file name based on date time.
Dim d As System.DateTime = System.DateTime.Now
Dim cur As New System.Globalization.CultureInfo("en-US")
Dim sdate As String = d.ToString("yyyyMMddHHmmss", cur)
Dim fileName As String = [String].Format("{0}\{1}{2}{3}.txt", _
mailbox, sdate, d.Millisecond.ToString("d3"), i)
'save email to local disk
oMail.SaveAs(fileName, True)
'mark email as deleted from POP3 server.
oClient.Delete(info)
Next
'quit and pure emails marked as deleted from POP3 server.
oClient.Quit()
Catch ep As Exception
Console.WriteLine(ep.Message)
End Try
Thats basically it, it downloads all email messages from your Gmail account to the folder called 'inbox' its up to figure out how to read the emails.(just stream reader + populating all folders)
Important notes:
It will only DL each email once, you can change the email extension(its currently .txt)
Full code looks like this:
Code:
Imports System.IO
Imports System
Imports EAGetMail 'imports EAGetMail namespace
Public Class Form1
' to save the email retrieved.
Dim curpath As String = Directory.GetCurrentDirectory()
Dim mailbox As String = [String].Format("{0}\inbox", curpath)
Dim r As IO.StreamReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Directory.Exists(mailbox) Then
Directory.CreateDirectory(mailbox)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oServer As New MailServer("pop.gmail.com", _
"username@gmail.com", "passwordr", ServerProtocol.Pop3)
Dim oClient As New MailClient("TryIt")
'if your POP3 server requires SSL connection,
'please add the following codes:
oServer.SSLConnection = True
oServer.Port = 995
Try
oClien*****nnect(oServer)
Dim infos As MailInfo() = oClient.GetMailInfos()
For i As Integer = 0 To infos.Length - 1
Dim info As MailInfo = infos(i)
Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}", _
info.Index, info.Size, info.UIDL)
'receive email from POP3 server
Dim oMail As Mail = oClient.GetMail(info)
Console.WriteLine("From: {0}", oMail.From.ToString())
Console.WriteLine("Subject: {0}" & vbCr & vbLf, oMail.Subject)
'generate an email file name based on date time.
Dim d As System.DateTime = System.DateTime.Now
Dim cur As New System.Globalization.CultureInfo("en-US")
Dim sdate As String = d.ToString("yyyyMMddHHmmss", cur)
Dim fileName As String = [String].Format("{0}\{1}{2}{3}.txt", _
mailbox, sdate, d.Millisecond.ToString("d3"), i)
'save email to local disk
oMail.SaveAs(fileName, True)
'mark email as deleted from POP3 server.
oClient.Delete(info)
Next
'quit and pure emails marked as deleted from POP3 server.
oClient.Quit()
Catch ep As Exception
Console.WriteLine(ep.Message)
End Try
End Sub
end class
Enjoy
Posts 1–15 of 26 · Page 1 of 2
Post a Reply
Tags for this Thread
None
Nice song and nice tut.
Approved...
Yo dude You gave away your gmail email and password LOL
your pass is in there or you do that on purpose? on the second one..
shit lol w/e, whoever just tried to get into my account is now about to be ddosed the shit out of lol nubs
Originally Posted by Bombsaway707
shit lol w/e, whoever just tried to get into my account is now about to be ddosed the shit out of lol nubs
LMFAO i tried once but it didnt work D:<
Originally Posted by Bombsaway707
shit lol w/e, whoever just tried to get into my account is now about to be ddosed the shit out of lol nubs
So scared /
Originally Posted by Virtual Void
So scared /
your gonna get IP'd on MPGH as well so
+if u got in my gmail acct ud see i didnt use it for shit haha
Originally Posted by Bombsaway707
your gonna get IP'd on MPGH as well so
+if u got in my gmail acct ud see i didnt use it for shit haha
why the hell would i want a worthless gmail account? think boy .
Originally Posted by Virtual Void
why the hell would i want a worthless gmail account? think boy .
whoever got on my gmail acct got IP'd from MPGH thought you were saying you did
And yeah thats why i didnt care 2 much ahah i only made it for my ca acct which got banned
Originally Posted by Bombsaway707
whoever got on my gmail acct got IP'd from MPGH thought you were saying you did
And yeah thats why i didnt care 2 much ahah i only made it for my ca acct which got banned
What if i did get the gmail
Originally Posted by Virtual Void
What if i did get the gmail
you didn't cuz i changed the PW + i can see who's IPs accessed it, but if you did it wouldn't matter, i have no accounts except for CA under it
+the pw was one generated randomly so i dont use it for any of my other accounts
wasnt me i tried but the pass was changed
Originally Posted by kunal1212
wasnt me i tried but the pass was changed
2 people got IP'd from MPGH idk who tho doesnt matter in the end