Hallo,
da steh ich wieder nu mit meinem Talent.
Obiges Script habe ich angewandt, um meine Mails automatisch in die Datenbank von DT abzulegen.
Was mir unter Mojave Os nicht gelingen mag, daß dieses Script mir, nach einer erstellten Regel ,
auch in den passenden Unterordner ablegt, sondern alles in die Inbox des Hauptordners.
Bsp.: Ich habe eine Mail Adresse (kaufen@t-online.de) für Stromanbieter, Amazon und Internetanbieter angegeben. Damit ich ein bisschen den Durchblick behalte, habe ich in diesem Account jeweils drei Unterordner erstellt und lasse per Regel die ankommenden Mails dort ablegen.
Bei High Sierra hat er auch dies auch in DT passend abgelegt.
Wie kann man das Script soweit anpassen, daß das auch weiterhin klappt?
Gruß
Rippchen mit Kraut
Hier noch mal das Script:
– POSIX path of destination database. Global inbox is used if not specified.
property pDatabasePath : “/pfad/zu/meiner/Datenbank”
– This string is used when the message subject is empty
property pNoSubjectString : “(no subject)”
using terms from application “Mail”
on perform mail action with messages theMessages for rule theRule
tell application id “DNtp”
if pDatabasePath is “” then
set destination_database to inbox
else
set destination_database to open database pDatabasePath – Ensure that the database is open
end if
end tell
tell application "Mail"
set theFolder to (POSIX path of (path to temporary items))
repeat with theMessage in theMessages
try
tell theMessage
set {theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag} to {the date received, the date sent, the sender, subject, the source, the read status}
-- Location of message
set theMessageLocation to "/"
try
set theMailbox to mailbox of theMessage
repeat while theMailbox is not missing value
set theName to name of theMailbox
set theMessageLocation to "/" & (theName as string) & theMessageLocation
set theMailbox to container of theMailbox
end repeat
end try
set theMessageLocation to "/Apple Mail" & theMessageLocation
end tell
set numAttachments to count of mail attachments of theMessage
if theSubject is equal to "" then set theSubject to pNoSubjectString
tell application id "DNtp"
set message_group to create location theMessageLocation in destination_database
create record with {name:theSubject & ".eml", type:unknown, creation date:theDateSent, modification date:theDateReceived, URL:theSender, source:(theSource as string), unread:(not theReadFlag)} in message_group
if numAttachments > 0 then set attachment_group to create location theMessageLocation & "/Attachments" in destination_database
end tell
repeat with theAttachment in mail attachments of theMessage
set theFile to theFolder & (name of theAttachment)
tell theAttachment to save in theFile
tell application id "DNtp"
set theAttachmentRecord to import theFile to attachment_group
set unread of theAttachmentRecord to (not theReadFlag)
set URL of theAttachmentRecord to theSender
end tell
end repeat
end try
end repeat
end tell
end perform mail action with messages
end using terms from