Page 1 of 1

Check POP3 email with Visual Basic 6

Posted: Tue Jan 18, 2005 8:43 am
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

Posted: Tue Jan 18, 2005 6:07 pm
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

Posted: Sat Jan 22, 2005 7:46 am
by AngusL