I’m an AppleScript newbie, so maybe my question is quite easy to answer. I need a folder action which monitors an FTP-folder and sends me an email (via Apple Mail) when someone puts something in the FTP-folder. I hope someone can help.
After trying all sorts of things i managed to make a script that generates an email (yehaaa )
tell application "Mail"
set theRecipients to {"test@test"}
set theDisplayName to "test"
set theSubject to "This is a test"
set theSender to "test@test"
set theMsg to make new outgoing message
tell theMsg
repeat with thisName in theRecipients
make new to recipient at beginning of to recipients ¬
with properties {address:thisName, name:theDisplayName}
end repeat
set sender to theSender
set subject to theSubject
end tell
send theMsg
end tell
The only thing i need now is a folder action to start the mailscript when something is added to the folder. Any help?
The folder action is finished and it was actually quite easy. It watches a folder and sends an email when things are added to the folder.
"on adding folder items to this_folder after receiving added_items
tell application "Mail"
set theRecipients to {"test@testemailadress"}
set theDisplayName to "test"
set theSubject to "This is a test"
set theSender to "test@testemailadress"
set theMsg to make new outgoing message
tell theMsg
repeat with thisName in theRecipients
make new to recipient at beginning of to recipients ¬
with properties {address:thisName, name:theDisplayName}
end repeat
set sender to theSender
set subject to theSubject
end tell
send theMsg
end tell