i would like to modify the script but have no experience in applescript. is there a way to add a mail to tag with subject, and body info into the reply email. with each list item wrapped in this tag. when the item is clicked it would open an email with the subject saying “send document (security code)” and the body taking the body of the previous email and adding the document requested into the body. so the overall reply email body contents would look like this
/users/name/documents/(item listed in email that you click on)
here is the script.
using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
-- PROCESS THE MESSAGES PASSED TO THIS HANDLER
tell application "Mail"
repeat with i from 1 to the count of these_messages
set this_message to item i of these_messages
tell this_message
set this_subject to its subject
set the reply_address to its reply to
set this_sender to its sender
set this_content to its content
end tell
set the folder_path to the first paragraph of this_content
set the folder_items to my list_folder(folder_path)
set the outgoing_message to make new outgoing message with properties {subject:"Folder Items List"}
tell outgoing_message
make new to recipient with properties {address:this_sender}
set content to folder_items
-- set visible to true
end tell
send outgoing_message
end repeat
end tell
end perform mail action with messages
end using terms from
on list_folder(folder_path)
try
set this_folder to (folder_path as POSIX file as alias)
set these_items to list folder this_folder without invisibles
set AppleScript's text item delimiters to return
set this_text to these_items as Unicode text
set AppleScript's text item delimiters to ""
return this_text
on error
return "The folder at path: " & folder_path & " doesn't exist."
end try
end list_folder
thanks for any help
aslo here is the script for the send document prob not needed
using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
-- PROCESS THE MESSAGES PASSED TO THIS HANDLER
tell application "Mail"
repeat with i from 1 to the count of these_messages
set this_message to item i of these_messages
tell this_message
set this_subject to its subject
set the reply_address to its reply to
set this_sender to its sender
set this_content to its content
end tell
set the document_path to the first paragraph of this_content
set the outgoing_message to make new outgoing message with properties {subject:"Requested Document"}
tell outgoing_message
make new to recipient with properties {address:this_sender}
set the check_result to my document_exists(document_path)
if check_result is false then
set content to "The document at path: " & document_path & " doesn't exist."
else
tell content
make new attachment at before paragraph 1 with properties {file name:document_path}
end tell
end if
-- set visible to true
end tell
send outgoing_message
end repeat
end tell
end perform mail action with messages
end using terms from
on document_exists(document_path)
try
set this_document to (document_path as POSIX file as alias)
return this_document
on error
return false
end try
end document_exists