2009-11-12 7 views
0

내받은 편지함에있는 모든 메시지를 취하는 Applescript for Mail.app을 작성해야하고 특정 일보다 오래된 메시지를 각각의 폴더로 옮길 수 있습니다. "On My Mac "또는 로컬 폴더에 저장됩니다.AppleScript로 Mail.app에 이메일 보관하기

내 IMAP 계정이되는 이유는 120 일 할당량 한도가 있기 때문에 직접 전자 메일을 로컬 폴더에 "보관"하는 대신 자동화 할 것입니다.

답변

0

지금까지 해보신 것은 무엇입니까? 귀하의 질문은 매우 광범위합니다. 다음을 시작해야합니다.

property secondsIn120Days : 10368000 

tell application "Mail" 

    set theInbox to inbox 

    set dateToday to current date 

    set firstMessage to 1 
    set lastMessage to (get count of messages in theInbox) 

    repeat with thisMessage from lastMessage to firstMessage by -1 
     set currentMessage to message thisMessage of theInbox 
     set messageDate to date received of currentMessage 

     set timeDifference to dateToday - messageDate 

     if timeDifference ≥ secondsIn120Days then 

      (* In answer to your comment, any folder you create to archive 
      messages is going to be in the "On My Mac" directory. But say you 
      create a Smart Mailbox called "Mail Archive" then all you should 
      need are these lines... *) 

      set archiveMailbox to (mailbox ("Mail Archive" as string)) 
      move currentMessage to archiveMailbox 

     end if 
    end repeat 
end tell 

업데이트 : 코드에 주석에 대한 응답을 추가했습니다.

+0

나는 이것을 보았다 : http://www.doughellmann.com/projects/MailArchiveByDate/. 기본적으로 나는 그것을하고 싶지만 달로 분류하지 않고 싶다. 나는 그것이 단지 하나의 최상위 폴더에 있기를 원합니다. – churnd

+0

메시지 보관을 위해 만든 폴더는 "내 Mac"디렉토리에 있습니다. 하지만 "Mail Archive"라는 스마트 메일 박스를 만들고 다음 줄만 있으면됩니다. "archiveMailbox를 (mailbox ("Mail Archive "문자열로) 설정하십시오.) currentMessage를 archiveMailbox로 이동하십시오."위의 업데이트 된 코드를 참조하십시오. 적절한 서식 지정. –