Search code examples
coldfusiongmailcoldfusion-8

Using cfpop to access gmail in CF8


So I need to use ColdFusion 8 to check a GMail account for emails, eventually I'll download the attachments. I've Googled and not found much except for the following code. What bugs me is that, that's all I've found.

So is this the best way to go?

Here is the code. I've included the link but there is not much more information.

<cfscript>
    javaSystem = createObject( "java", "java.lang.System" );
    jProps = javaSystem.getProperties();
    jProps.setProperty( "mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory" );
    jProps.setproperty( "mail.pop3.port", 995 );
    jProps.setProperty( "mail.pop3.socketFactory.port", 995 );
</cfscript>

<cfpop action="getheaderonly" name="rsEmail" startrow="1? maxrows="50" server="pop.gmail.com" port="995" username="[email protected]" password="yourpassword">

Using CFPOP to check mail on GMail


Solution

  • This will work but you should know that it sets the GLOBAL SSL socketfactory for POP3. I believe this will have a serverwide affect - which may be irrelevant to your process but it is worth noting.