[RESOLVED] Chilkat emails
Hey,
ON Chilkat they have this piece of code
Code:
TextBox1.Text = ""
' Create a mailman object for reading email.
Dim mailman As New Chilkat.MailMan()
' Any string passed to UnlockComponent automatically begins a 30-day trial.
Dim success As Boolean
success = mailman.UnlockComponent("*code*")
If (success <> True) Then
MsgBox(mailman.LastErrorText)
Exit Sub
End If
' Set our POP3 hostname, login and password
mailman.MailHost = "pop.gmail.com"
mailman.PopUsername = "*mail*"
mailman.PopPassword = "*password*"
' Connecting via SSL is possible by adding these lines:
mailman.PopSsl = True
' Set the POP3 port to 995, the standard MS Exchange Server SSL POP3 port.
mailman.MailPort = 995
' Set our filter to only return PayPal payment notification emails.
'mailman.Filter = "Subject like ""*Notification of Payment Received*"""
' Use GetAllHeaders to fetch each email header and the 1st N lines of
' the body from a POP3 server.
' Note: Attachment information will not be available. This is a shortfall
' of the POP3 protocol because attachment information is not included
' in POP3 headers. An entire POP3 email must be read in order to get complete
' attachment information.
Dim bundle As Chilkat.EmailBundle = mailman.GetAllHeaders(2) ' Get 2 body lines...
If bundle Is Nothing Then
MessageBox.Show(mailman.LastErrorText)
Return
End If
Dim i As Integer
Dim n As Integer = bundle.MessageCount
MsgBox(bundle.MessageCount)
For i = 0 To n - 1
Dim email As Chilkat.Email = bundle.GetEmail(i)
TextBox1.Text = TextBox1.Text + email.From + ControlChars.Cr + ControlChars.Lf
TextBox1.Text = TextBox1.Text + email.Subject + ControlChars.Cr + ControlChars.Lf
ListBox1.Items.Add(email.Subject)
Next i
All of the emails end up in the same textbox.
Is there a way to store the emails in a file or in the memory so when I clikc on the subject in a listbox, it appears in the textbox?
I was thinking of usnig arrays, but then I'd probably use the formatting (new lines etc).
Re: [RESOLVED] Chilkat emails
Hi, you may do it a litle simpler than that, you can just use str() methode in a listview like this:
vb Code:
Dim str(8) As String
Dim itm As ListViewItem
For i = 0 To bundle.MessageCount - 1
str(0) = email.From
str(1) = email.Subject
str(2) = email.EmailDate
itm = New ListViewItem(str)
mailList.Items.Add(itm)
Re: [RESOLVED] Chilkat emails
What is this 30 day trial thing in the code does that mean? Do you have to buy this stuff?