cfpop - do not want to retrieve duplicate emails

View: New views
11 Messages — Rating Filter:   Alert me  

cfpop - do not want to retrieve duplicate emails

by Joshua Rowe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello,

We need to be able to POP emails from a Yahoo! Mail account without deleting the emails and without retrieving the same email twice.  If I set the action attribute to "Delete" in the <cfpop> tag, it deletes the email from the Yahoo account.  Is there a way to only pop unique emails without deleting them from the mail box?

Best regards,
Joshua Rowe


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328077
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: cfpop - do not want to retrieve duplicate emails

by Paul Vernon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> We need to be able to POP emails from a Yahoo! Mail account without
> deleting the emails and without retrieving the same email twice.  If I
> set the action attribute to "Delete" in the <cfpop> tag, it deletes the
> email from the Yahoo account.  Is there a way to only pop unique emails
> without deleting them from the mail box?

Keep a copy of the UID's you have downloaded locally, compare against the
UID's on the server and only do a GETALL on the ones you haven't seen before
and then store those UID's too.

This process will get progressively slower as more and more e-mails are left
on the server though.

CFX_POP3 has a GETUIDLIST function which just retrieves the UID's of the
mails on the server and makes the process lightening fast but it only works
on 32-bit CF installations on Windows so it's life is limited now.

Paul




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328083
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: cfpop - do not want to retrieve duplicate emails

by Paul Vernon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> > We need to be able to POP emails from a Yahoo! Mail account without
> > deleting the emails and without retrieving the same email twice.  If
> I
> > set the action attribute to "Delete" in the <cfpop> tag, it deletes
> the
> > email from the Yahoo account.  Is there a way to only pop unique
> emails
> > without deleting them from the mail box?
>
> Keep a copy of the UID's you have downloaded locally, compare against
> the
> UID's on the server and only do a GETALL on the ones you haven't seen
> before
> and then store those UID's too.
>
> This process will get progressively slower as more and more e-mails are
> left
> on the server though.
>
> CFX_POP3 has a GETUIDLIST function which just retrieves the UID's of
> the
> mails on the server and makes the process lightening fast but it only
> works
> on 32-bit CF installations on Windows so it's life is limited now.
>

After writing this, I figured that there should be a way to retrieve the UID
values more quickly than CFPOP and without using my own CFX tag so I've just
been playing around with the CF Java libraries and it turns out you can so I
blogged about it and made the code available as a download.

http://blog.newmediadevelopment.net/2009/11/extending-cfpop-to-eventually-re
place-cfx_pop3.html

My pure CF code can retrieve the UID's in a 2000 message mailbox on average
0.425s

Using CFPOP getHeaderOnly takes around 80 seconds on average for the same
mailbox...

Using CFX_POP3 using getUIDList takes on average 0.73 seconds again for the
same mailbox.

This means that the function I've written is now the fastest way I know of
to retrieve a list of UID values from a POP3 mailbox.

Happy times :-).



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328086
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: cfpop - do not want to retrieve duplicate emails

by Rick Faircloth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Good stuff, Paul...thanks for sharing the code!

Rick

-----Original Message-----
From: Paul Vernon [mailto:paul.vernon@...]
Sent: Friday, November 06, 2009 9:48 AM
To: cf-talk
Subject: RE: cfpop - do not want to retrieve duplicate emails


> > We need to be able to POP emails from a Yahoo! Mail account without
> > deleting the emails and without retrieving the same email twice.  If
> I
> > set the action attribute to "Delete" in the <cfpop> tag, it deletes
> the
> > email from the Yahoo account.  Is there a way to only pop unique
> emails
> > without deleting them from the mail box?
>
> Keep a copy of the UID's you have downloaded locally, compare against
> the
> UID's on the server and only do a GETALL on the ones you haven't seen
> before
> and then store those UID's too.
>
> This process will get progressively slower as more and more e-mails are
> left
> on the server though.
>
> CFX_POP3 has a GETUIDLIST function which just retrieves the UID's of
> the
> mails on the server and makes the process lightening fast but it only
> works
> on 32-bit CF installations on Windows so it's life is limited now.
>

After writing this, I figured that there should be a way to retrieve the UID
values more quickly than CFPOP and without using my own CFX tag so I've just
been playing around with the CF Java libraries and it turns out you can so I
blogged about it and made the code available as a download.

http://blog.newmediadevelopment.net/2009/11/extending-cfpop-to-eventually-re
place-cfx_pop3.html

My pure CF code can retrieve the UID's in a 2000 message mailbox on average
0.425s

Using CFPOP getHeaderOnly takes around 80 seconds on average for the same
mailbox...

Using CFX_POP3 using getUIDList takes on average 0.73 seconds again for the
same mailbox.

This means that the function I've written is now the fastest way I know of
to retrieve a list of UID values from a POP3 mailbox.

Happy times :-).





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328087
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Retrieving UID values from a POP mailbox (quickly) WAS: cfpop - do not want to retrieve duplicate emails

by Paul Vernon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Cheers Rick. I have to say I'm rather impressed with myself as I don't tend
to play around with the Java internals of CF that much but the process of
building this function was relatively straight forward...

I did have some weird issues when I was developing it this morning though..

For example, the code below fails:

21: <cfset javaProps.setProperty("mail.pop3.port", arguments.port)>
22: <cfset javaProps.setProperty("mail.pop3.connectiontimeout",
arguments.timeout*1000)>

The error message is "The setProperty method was not found. <snip> The error
occurred on line 22."

BUT... this code works:

21: <cfset javaProps.setProperty("mail.pop3.port", arguments.port)>
22: <cfset javaProps.setProperty("mail.pop3.connectiontimeout",
arguments.timeout)>

I have *no idea* why the former breaks and the latter works... None
whatsoever...

I tried using JavaCast("int", arguments.timeout*1000) but that didn't work
either..

If anyone would like to shed some light on why I would see that error I'd be
most grateful :-).

Paul

> Good stuff, Paul...thanks for sharing the code!
>
> Rick
>
> >
http://blog.newmediadevelopment.net/2009/11/extending-cfpop-to-eventually-re
> > place-cfx_pop3.html





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328101
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: cfpop - do not want to retrieve duplicate emails

by Joshua Rowe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Perfect!  This is exactly what I needed!  Thanks again and nice work! :)

-Josh


-----Original Message-----
From: Paul Vernon [mailto:paul.vernon@...]
Sent: Friday, November 06, 2009 7:48 AM
To: cf-talk
Subject: RE: cfpop - do not want to retrieve duplicate emails


> > We need to be able to POP emails from a Yahoo! Mail account without
> > deleting the emails and without retrieving the same email twice.  If
> I
> > set the action attribute to "Delete" in the <cfpop> tag, it deletes
> the
> > email from the Yahoo account.  Is there a way to only pop unique
> emails
> > without deleting them from the mail box?
>
> Keep a copy of the UID's you have downloaded locally, compare against
> the
> UID's on the server and only do a GETALL on the ones you haven't seen
> before
> and then store those UID's too.
>
> This process will get progressively slower as more and more e-mails are
> left
> on the server though.
>
> CFX_POP3 has a GETUIDLIST function which just retrieves the UID's of
> the
> mails on the server and makes the process lightening fast but it only
> works
> on 32-bit CF installations on Windows so it's life is limited now.
>

After writing this, I figured that there should be a way to retrieve the UID
values more quickly than CFPOP and without using my own CFX tag so I've just
been playing around with the CF Java libraries and it turns out you can so I
blogged about it and made the code available as a download.

http://blog.newmediadevelopment.net/2009/11/extending-cfpop-to-eventually-re
place-cfx_pop3.html

My pure CF code can retrieve the UID's in a 2000 message mailbox on average
0.425s

Using CFPOP getHeaderOnly takes around 80 seconds on average for the same
mailbox...

Using CFX_POP3 using getUIDList takes on average 0.73 seconds again for the
same mailbox.

This means that the function I've written is now the fastest way I know of
to retrieve a list of UID values from a POP3 mailbox.

Happy times :-).





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328094
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Parent Message unknown re: Retrieving UID values from a POP mailbox (quickly) WAS: cfpop - do not want to retrieve duplicate emails

by Jason Fisher-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Been awhile since I played around with Java internals, too (and it was the
mail libraries then, too), but try the Cast just around the variable,
perhaps:

<cfset javaProps.setProperty("mail.pop3.connectiontimeout", JavaCast("int",
arguments.timeout) * 1000)>

worth a shot, since we know that 1000 should be seen as int already ...
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328106
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: Retrieving UID values from a POP mailbox (quickly) WAS: cfpop - do not want to retrieve duplicate emails

by DURETTE, STEVEN J (ATTASIAIT) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


How about putting the arguments.timeout * 1000 in ()

(Arguments.timeout * 1000)

Or <cfset test = Arguments.timeout * 1000 />

Then using it?  I'm guessing that java is trying to parse the * 1000
instead of letting ColdFusion do it?

Just a theory. I don't really know how that interaction works.

Steve


-----Original Message-----
From: Jason Fisher [mailto:jason@...]
Sent: Friday, November 06, 2009 4:27 PM
To: cf-talk
Subject: re: Retrieving UID values from a POP mailbox (quickly) WAS:
cfpop - do not want to retrieve duplicate emails


Been awhile since I played around with Java internals, too (and it was
the
mail libraries then, too), but try the Cast just around the variable,
perhaps:

<cfset javaProps.setProperty("mail.pop3.connectiontimeout",
JavaCast("int",
arguments.timeout) * 1000)>

worth a shot, since we know that 1000 should be seen as int already ...
 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328107
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

SOLVED: Retrieving UID values from a POP mailbox (quickly) WAS: cfpop - do not want to retrieve duplicate emails

by Paul Vernon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> Been awhile since I played around with Java internals, too (and it was
> the
> mail libraries then, too), but try the Cast just around the variable,
> perhaps:
>
> <cfset javaProps.setProperty("mail.pop3.connectiontimeout",
> JavaCast("int",
> arguments.timeout) * 1000)>
>
> worth a shot, since we know that 1000 should be seen as int already ...

I solved it... You won't believe it though!

<!--- cast the timeout value to a string no-less!!! --->
<cfset var conTimeout = JavaCast("string", arguments.timeout*1000)>
<cfset javaProps.setProperty("mail.pop3.connectiontimeout", conTimeout)>

If I place the JavaCast in the setProperty function, it doesn't work either
so there we are :-)

Paul



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328108
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Retrieving UID values from a POP mailbox (quickly) WAS: cfpop - do not want to retrieve duplicate emails

by cfSearching :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> If anyone would like to shed some light on why I would see
> that error I'd be most grateful :-).
>
> Paul

It sounds like a combination of things. Just one of those issues you run into when communicating between strong (java) and weakly typed (CF) languages.  Java's setProperty(string key, string val) method expects two "strings" .. only. If you try and pass in the timeout value as anything other than a "string", CF will probably tell you it cannot find the method .. because it cannot. That error is often another way of saying, "Hey, I may be able to find _some_ setProperty() method, just not one with a signature that matches the input you are giving me."

Depending on what do with the timeout value, sometimes it is a string

<cfset arguments.timeout = 3 />
arguments.timeout type = <cfdump var="#arguments.timeout.getClass().getName()#"> <br />

 .. and sometimes it is a java.lang.Double

<cfset x = arguments.timeout * 1000 />
x type = <cfdump var="#x.getClass().getName()#"> <br />

So my guess is, the the multiplication implicitly converted the value to another data type, and CF could no longer call the method because the parameters did not match the java signature:  setProperty(string, string)

HTH
-Leigh





     


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328113
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: SOLVED: Retrieving UID values from a POP mailbox (quickly) WAS: cfpop - do not want to retrieve duplicate emails

by cfSearching :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I solved it... You won't believe it though!
>
> <!--- cast the timeout value to a string no-less!!!
> --->

Yes, it *must* be "string" because that is what java expects:
http://java.sun.com/javase/6/docs/api/java/lang/System.html#setProperty%28java.lang.String,%20java.lang.String%29


> If I place the JavaCast in the setProperty function, it
> doesn't work either

Paul, are you positive it does not work? It does for me (CF8). Maybe you were just casting it to a different type?

<cfset javaProps.setProperty("mail.pop3.connectiontimeout", javacast("string", arguments.timeout*1000)) />

-Leigh


     


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328114
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4