You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

applescript to move email attachments

i am new to mac and have no clue how to make a script


i want to have all my email attachments from one sender go to a folder on my network drive and automaticly print all pdf's any help would be greatly appreciated

MacBook Air, iOS 7.1

Posted on Mar 25, 2014 9:01 PM

Reply
17 replies

Oct 16, 2015 12:39 AM in response to markgbb

I'm trying to get this to work on El Capitain. The Mail Rule i have set up works, this is proven by flagging the mail. Unfortunately i cannot get the attachments saved. I have tried different folder locations but didn't succedd. Can anyone have a look on the script i'm using? Might there be someone to help me through remote desktop connection? I would pay for the service. Best Oliver


using terms from application "Mail"

on perform mail action with messagestheMessages

set attachmentsFolder to "Volumes:Macintosh HD:Users:oliveremmler:Desktop:WorkOrders:" as rich text

tell application "Mail"

set selectedMessages to theMessages

try

repeat with theMessage in selectedMessages

set counter to 1 -- added

repeat with theAttachment in theMessage'smail attachments

set subjectText to (get theMessage'ssubject) as rich text

set originalName to ((every word of subjectText) as rich text)

set savePath to attachmentsFolder & originalName & (counter as rich text) --modified

set counter to counter + 1 -- added


savetheAttachmentinfilesavePath

end repeat

end repeat

end try

end tell

end perform mail action with messages

end using terms from

applescript to move email attachments

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.