Check POP3 email with Visual Basic 6

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Check POP3 email with Visual Basic 6

Post by evilmonkey »

Hello. Before you ask, no, I have not gone over to the dark side. I am still very much into OSS developement, but I've recently found something fun. Microsoft Agent programming. I got the hang of basic scripting and I can pretty much make these little guys do anything I want.

Now, I want these characters checking my email when they boot up. For that, I need some kind of function written in Visual Basic that will return a 1 if I have new email, and 0 if I don't. Eventually, I also want the little c haracter to tell me who the email is from, but that's later. I have never programmed VB before, and I need some kind of tutorial, or some kind of example for my purpose. Can anyone help?

Thanks :D
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Ugh, I just got a nice "Welcome" to Visual Basic. Everything needs a proprietary module. Damn, this is frustrating. Nevertheless, I got the trial version of the module I needed, and produced the following code.

Code: Select all

Private Function checkmail()
Set bonzi = Agent1.Characters("Bonzi")
Set checkPOP = CreateObject("EasyMail.POP3")
'checkPOP.LicenseKey = "" No key, trial mode
checkPOP.MailServer = "pop3.yourselrver.com"
checkPOP.Account = "your_email_username"
checkPOP.Password = "your_password"
checkPOP.Connect
cnt = objPOP3.GetDownloadableCount()
If cnt = 0 Then
    bonzi.Speak ("You have no new mail!")
    Return 1
Else
    bonzi.Speak ("You've got mail!")
    Return 1
End If
checkPOP.Disconnect
End Function
AngusL
Forum Contributor
Posts: 155
Joined: Fri Aug 20, 2004 4:28 am
Location: Falkirk, Scotland

Post by AngusL »

Post Reply