ElegentJ POP3 bean - need help

Questions and answers on developing, deploying and using plugins and JavaBeans

ElegentJ POP3 bean - need help

Postby grahamg » Mon Jul 19, 2004 2:24 pm

Can anyone provide guidance on getting the Elegent POP3 bean to work with Servoy ??


Using Matt Petrowski's great tutorial - http://forum.servoy.com/viewtopic.php?t=1408 - I have the SMTP bean working fine but just can't work out how to control the POP version.

Thanks in advance

GrahamG
grahamg
 
Posts: 752
Joined: Fri Oct 03, 2003 3:15 pm
Location: Midlands UK

Postby Harjo » Wed Aug 04, 2004 12:04 am

Yes, I could use some help on this one too!

I have this so far:

Code: Select all
var m = elements.bean_296
m.hostName = 'your.provider.com'
m.userName = 'youraccountname'
m.password = 'yourpassword'
m.port = 110

m.openConnection()
var a = m.getNoOfMessage()
var c = m.getMail(a)


var a = returning: 1 //that is correct, there is one email in my emailbox
var c = returning: null //that one I don't get!

Could someone help us a bit?
for example how do we get the subject, body etc..
I see all those codes in de API-docs but I can't see or reach them in Servoy in the bean!
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby patrick » Wed Aug 04, 2004 9:22 am

It should be like this:

Code: Select all
var num_messages = m.getNoOfMessage() // this will give you the number of messages
for ( var i = 1 ; i <= messages ; i++ )
{
   var a_message = pop.getMail(i); // will return a message object of message i
   parseMessage(a_message);
}


and then in parseMessage() you can do this

Code: Select all
var m = arguments[0];
var m_to = m.getTO();
var m_from = m.getFrom();
and so on..,


getMail will return a message object. This object has lots of methods and attributes that you can "play" with...

I have done a very nice pop3 client with this bean, but I do have a problem when message are "big" (more than a few KB). Johan did some investigation on this and came to the same result, but has no closer insight (yet) to the issue. If anyone else has that problem, please let me know so we can get this working.

Thanks
Patrick
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby patrick » Wed Aug 04, 2004 9:35 am

But then another question for the pros...

I have tried some other bean package with a tremendous feature set (you can, for example, retrieve single message parts etc.). This bean works perfectly for receving mails.

When sending mails, however, the SMTP bean expects a message object to be send. The problem now is that I don't have access to a message bean (it just doesn't show up). I suppose this is because Servoy only supports "interface beans"? When retrieving mails this problem does not occur because the POP3 bean returns a message object. Is there anything we can do about this or that I can tell the developers?

Thanks!
Patrick
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby Harjo » Wed Aug 04, 2004 10:34 am

I have tried some other bean package


Can you tell us, which bean package?
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby patrick » Wed Aug 04, 2004 11:17 am

It is called iNet Factory and can be found at http://www.jscape.com/
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Postby Harjo » Wed Aug 04, 2004 11:21 am

but I do have a problem when message are "big" (more than a few KB).


Aha, that's my problem too! I had one email with an attachement of 89Kb
Than m.getMail() returns null!!

I tried it with a smaller email (just text, no attach) and than it works well!

It's a shame it does not work, with larger emails. :(
Is it a bug in the bean, or something in Servoy?
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby patrick » Wed Aug 04, 2004 12:08 pm

yes, that is a problem. I have seen that your

Code: Select all
var a = m.getNoOfMessage()
var c = m.getMail(a)


should have returned the last message. If you get a null there once, you are out of business...

This is what Johan wrote to me:

hmm if i dig a bit deeper into the component then yes if the size is large then the pop bean just doesn't return a message.
I will try to test it in pure java for you but i think this is somehow a limitation of that bean


Actually I don't think it's a bug. The guys have lots of functionality around attachments, so I guess they tested that one... Maybe some strange problem that just occurs when you use the bean inside Servoy...
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 4 guests

cron