AppleScript für automatisierte Mail-Versendung mit Dateianhang geht nicht
Hey Leute,
Ich brauche ein AppleScript, welches über Outlook automatisiert Mails mit Datei-Anhängen versendet. Das Ganze soll dann über eine Logdatei getrackt werden, sodass keine Dateien doppelt herausgesendet werden.
Momentan sieht mein Code wie folgt aus:
set folderPath to "Users/tim.zzz/Desktop/ExcelBotTest/XYZ" -- Pfad zu Ihrem Ordner
set logFilePath to "Users/tim.zzz/Desktop/ExcelBotTest/Logdatei.rtf" -- Pfad zur Log-Datei
set emailAddress to "tim.zzz@xy.de" -- Ziel-E-Mail-Adresse
tell application "Finder"
set fileList to files of folder folderPath
end tell
set logContent to read file logFilePath
tell application "Microsoft Outlook"
repeat with aFile in fileList
set fileName to name of aFile
if logContent does not contain fileName then
set newMessage to make new outgoing message with properties {subject:fileName, content:"Hier ist Ihre Datei."}
make new recipient at newMessage with properties {email address:emailAddress}
tell newMessage
make new attachment with properties {file:aFile}
send
end tell
set logContent to logContent & fileName & " gesendet am " & (current date) & linefeed
end if
end repeat
end tell
Ergebnis: error "„Finder“ hat einen Fehler erhalten: „folder \"Users/tim.kesselnschlaeger/Desktop/ExcelBotTest/XYZ\"“ kann nicht gelesen werden." number -1728 from folder "Users/tim.kesselnschlaeger/Desktop/ExcelBotTest/XYZ"
Kann mir jemand da weiterhelfen?
MacBook Air 13″, macOS 13.6