[thelist] E-mails into database (again!)

Norman Beresford n.beresford at anansi.co.uk
Mon Aug 8 02:11:14 CDT 2005


Hi Kevin

If you're doing it on a server you own then go for the .net version.  I
used some code from code project for the POP3 component [1], and then to
actually do the connecting the code is as easy as:

            Dim pop = New pop3.Mail.Pop.Pop3
            pop.Host = ConfigurationSettings.AppSettings("EmailHost")
            pop.Port = ConfigurationSettings.AppSettings("EmailPort")
            pop.Username =
ConfigurationSettings.AppSettings("EmailAccount")
            pop.Password =
ConfigurationSettings.AppSettings("EmailPassword")
            pop.connect()
            pop.login()
            pop.GetAccountStat()

            If pop.MessageCount > 0 Then
                For i As Integer = 1 To pop.MessageCount
                    Dim m As pop3.Mail.Pop.Pop3Message =
pop.GetMessage(i)
		    Next
            End If 

It won't handle the emails already on your PC (although you could use
the Pop3Message class from that article as the basis of a hack to do
so).  HTH

Norman

1: http://www.codeproject.com/csharp/pop3client.asp




More information about the thelist mailing list