3

我每天都在使用 CFIMAP 下载电子邮件附件。尽管到目前为止我已经尝试过,但脚本是从我的所有文件夹中读取电子邮件,而不是仅从收件箱中读取。有人知道怎么修这个东西吗?

这是我的代码:

    <cfimap 
        server = "mail.example.com" 
        username = "user@sexample.com" 
        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">
4

1 回答 1

4

你可以试试下面的代码..

<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>
于 2013-03-07T07:17:13.967 回答