Skip to content

Instantly share code, notes, and snippets.

@LucaTNT
Last active December 18, 2015 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucaTNT/5701291 to your computer and use it in GitHub Desktop.
Save LucaTNT/5701291 to your computer and use it in GitHub Desktop.
Salva il file ICS allegato alle mail di conferma di acquisto di Trenitalia Saves the ICS file attached to Trenitalia purchase confirmation emails.
-- Edited by @LucaTNT, originally from Nigel Garvey (http://macscripter.net/viewtopic.php?id=29010)
property theAttachmentPath : (path to downloads folder) as Unicode text
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with This_Message in theMessages
repeat with ma in mail attachments of This_Message
set n to name of ma
if n ends with ".ics" then
save ma in file (theAttachmentPath & n)
my import_to_iCal(theAttachmentPath & n)
end if
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment