POP2Disk
Below you find the POP to disk script example based on the Aloaha POP3 SDK. The Aloaha POP3 SDK is part of the Aloaha SPAM Rejector. In case you need the standalone dll please contact aloaha@wrocklage.de
'This is a sample script for Aloahas scripted POP3 Connector
'It downloads all emailf from a pop3 mailbox and saves them to disk
'The scripted POP3 Connector is part of Aloaha SPAM Rejector
'Should you require the standalone dll please contact
'stefan@wrocklage.de
Dim pop
Dim amount
Dim adSaveCreateOverWrite
Dim adTypeText
Dim i
Dim strmail
Dim savedir
'savedir defines the directory
savedir="c:\temp"
adTypeText = 2
adSaveCreateOverWrite = 2
'Create Aloaha POP3 Connector Object
Set pop = CreateObject("pop3news.popnews")
'set server, username and password
'if pop port is a non default port such as gmail please use the .port property
pop.remotehost = "mail.aloaha.com"
pop.username = "web31p8"
pop.password = "testing"
'connect
If pop.autoconnect = True Then
'enumerate emails in pop3 mailbox
amount = CInt(pop.getammount)
If amount>0 Then
'download and save them to disk
For i = 1 to amount
err.clear
strmail=""
strmail = pop.getmail(CStr(i))
If strmail<>"" Then
Call saveto(strmail, savedir, "")
Call pop.deletemail(cstr(i))
End If
Next
End If
Call pop.close_and_quit
End If
Public Sub saveto(content, savetopath, fname)
On Error Resume Next
Dim fstream
Dim newfolder
If fname="" Then
fname=get_random_number+".eml"
End If
If savetopath <> "" Then
Set fstream = CreateObject("ADODB.Stream")
fstream.Type = adTypeText
fstream.Charset = "US-ASCII"
fstream.Open
fstream.WriteText content
If Right(savetopath, 1) <> "\" Then savetopath = savetopath & "\"
fstream.SaveToFile CStr(savetopath + fname), adSaveCreateOverWrite
fstream.Close
Set fstream = Nothing
End If
End Sub
Public Function get_random_number()
On Error Resume Next
Randomize
get_random_number = CStr(Int((100000 - 1 + 1) * Rnd + 100000))
End Function
Download above script (1,01 KB)
Home / Knowledge Base / POP3 SDK / POP 2 Disk