Applescript to fix emails with hidden attachments
a guest Jan 30th, 2013 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- set newFileName to (path to temporary items folder from user domain as string) ¬
- & (random number from 10000 to 99999) ¬
- & ".eml"
- tell application "Mail"
- set selectedMails to the selection
- if the length of selectedMails is greater than 0 then
- repeat with theMessage in selectedMails
- set newSource to my replaceText("Content-Type: multipart/related;", "Content-Type: multipart/mixed;", source of theMessage)
- set newFile to open for access newFileName with write permission
- write newSource to newFile starting at 0
- close access newFile
- open newFileName
- end repeat
- tell application "Finder" to delete file newFileName
- display alert "Selezionare uno o più messaggi e riprovare"
- end if
- end tell
- on replaceText(find, replace, someText)
- set prevTIDs to text item delimiters of AppleScript
- set text item delimiters of AppleScript to find
- set someText to text items of someText
- set text item delimiters of AppleScript to replace
- set someText to "" & someText
- set text item delimiters of AppleScript to prevTIDs
- return someText
- end replaceText
RAW Paste Data