Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CFIMAP Reading emails from all folders

I am using CFIMAP to download email attachments daily. Despite what I have tried so far the script is reading emails from all of my folders instead from only the inbox. Anyone know how to fix this?

This is my code:

    <cfimap 
        server = "mail.example.com" 
        username = "[email protected]" 
        action="open" 
        secure="yes" 
        password = "pass" 
        connection = "mail.example.com" >

      <cfimap   
        action="GetAll" 
        folder="Inbox"  
        name="test"
        attachmentpath="e:\testfolder" 
        GenerateUniqueFilenames="yes"
        connection="mail.example.com" >

    <cfimap 
        action="MoveMail" 
        newfolder="processedEmails" 
        stoponerror="true" 
        connection="mail.example.com">

   <cfimap action="close" connection = "mail.example.com">
like image 797
Geo Avatar asked Jan 30 '26 23:01

Geo


1 Answers

you can try the following code..

<cfimap action="open" connection="Conn" server="serverurl" username="useremail"      password="passwrd" secure="yes" port="">
<cfimap action="getall" connection="Conn" name="getAttachments" folder="Inbox" attachmentpath="#GetTempDirectory()#" >

<cfquery dbtype="query" name="getMailAttachments">
    select * 
  from getAttachments 
  where seen=<cfqueryparam value="no" cfsqltype="cf_sql_varchar"> 
   and ATTACHMENTS is not null
</cfquery>
<cfloop query="getMailAttachments">
   <cfimap action="MarkRead" connection = "Conn" uid="#getMailAttachments.UID#">
   <cfimap action="movemail" connection = "Conn"  newfolder="Read mails" uid="#getMailAttachments.UID#">
</cfloop>
like image 193
shemy Avatar answered Feb 01 '26 14:02

shemy