Problem retrieving messages

Discussion specific to the Catalyst Internet Mail control. This product implements multiple e-mail protocols in a single component.

Moderator: Catalyst

Problem retrieving messages

Postby Davide Sbreviglieri » Mon Dec 21, 2009 10:35 am

Hello,
I'm developing a small project to get unread messages from a mail address. To do this I'm using ListMail example that I've found in the installation directory of Catalyst Mail Control.
It works fine, but I can't get the body of the message.
Also scanning the whole property list of the control I can't find the body anywhere.
Can you help me?
Thank you very much.

Best Regards
Davide
Davide Sbreviglieri
New Member
 
Posts: 2
Joined: Mon Dec 21, 2009 10:11 am

Re: Problem retrieving messages

Postby Davide Sbreviglieri » Mon Dec 21, 2009 10:56 am

I solved the problem setting Options property = 1
Thank you anyway!

Regards
Davide Sbreviglieri
New Member
 
Posts: 2
Joined: Mon Dec 21, 2009 10:11 am

Re: Problem retrieving messages

Postby Technical Support » Mon Dec 21, 2009 10:59 am

The Message property returns the complete message, including the headers. The MessageText property returns just the body of the message. However, you need to call the GetMessage method first to retrieve the message contents from the server. Very simple code using the ActiveX control would look something like this:

Code: Select all
Dim nMessage As Long
Dim strMessage As String
   
For nMessage = 1 To InternetMail1.LastMessage
    ' Retrieve the message from the server
    nError = InternetMail1.GetMessage(nMessage)
    If nError = 0 Then
        ' Store the contents of the message in a string
        strMessage = InternetMail1.Message
        ' Do something with the message
    End If
Next


Basically you can just iterate through the available messages, call GetMessage to load the message into the control, and from there you can use the various properties to access parts of the message. Make sure you always check the return value from GetMessage.
Technical Support
Knowledge Base | FAQs | Online Help
Technical Support
Catalyst
 
Posts: 2288
Joined: Mon Dec 27, 2004 3:38 am
Location: California

Re: Problem retrieving messages

Postby Technical Support » Mon Dec 21, 2009 11:01 am

Davide Sbreviglieri wrote:I solved the problem setting Options property = 1
Thank you anyway!

Regards


Okay, that's a completely different issue. For anyone else reading this, that option enables implicit SSL connections, so his problem was apparently that whatever POP3 or IMAP4 server he was connecting to required that option.
Technical Support
Knowledge Base | FAQs | Online Help
Technical Support
Catalyst
 
Posts: 2288
Joined: Mon Dec 27, 2004 3:38 am
Location: California


Return to Internet Mail Control

Who is online

Users browsing this forum: No registered users and 1 guest

cron