mdelatorre

SmallCubed MailSuite script to auto download email attachments

Sep 30th, 2020 (edited)
250
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- The configuration can be watch in the image at: https://i.imgur.com/VKQZitv.png
  2. -- 1. Install the Mail Act-On component of SmallCubed MailSuite
  3. -- 2. Store the AppleScript in the ~/Library/Application Scripts/com.apple.mail/ Folder
  4.  
  5. use AppleScript version "2.7" -- Catalina (10.15)
  6. use scripting additions
  7. --                                             
  8. --  Save attachments of selected Mail messages to the folder you set for myAttachmentPath  
  9. --                                         
  10. set myAttachmentsPath to ("/Users/username/Desktop/myAttachments/")'s POSIX path       
  11. tell application "SmallCubed MailSuite"                        
  12.    repeat with aMessage in (get selection)                         
  13.       repeat with anAttachment in mail attachments of aMessage                 
  14.         set attachmentName to name of anAttachment                     
  15.      save anAttachment in POSIX file (myAttachmentsPath & attachmentName)          
  16.       end repeat                                       
  17.    end repeat                                          
  18. end tell
  19. </pre>                                         
RAW Paste Data