hi there
manually you can create a new email message, drag and drop any other email to this new email, Mail will then attach them as .eml file.
I would like to have an applescript to do this for me.
ideas?
thanks for your answers
simon
Operating System: Mac OS X (10.5)
Hoi Simon,
willkommen bei MacScripter.
Does this work for you, it attaches the selected messages to a new outgoing mail
set messageList to {}
tell application "Mail"
set theMessages to selection
set mailFolder to POSIX path of (path to library folder from user domain) & "Mail"
repeat with oneMessage in theMessages
set theID to (id of oneMessage as Unicode text) & ".emlx"
try
set messageLocation to do shell script "find " & quoted form of mailFolder & " -name " & theID
if messageLocation is not "" then set end of messageList to POSIX file messageLocation as alias
end try
end repeat
set newMessage to make new outgoing message with properties {subject:"theSubject", content:"theBody" & return & return}
tell newMessage
tell content
repeat with oneFile in messageList
make new attachment with properties {file name:oneFile} at after the last paragraph
end repeat
end tell
end tell
end tell
Hallo Stefan,
thanks for your script, pretty much what I had in my mind! I tried to add it to a Mail rule and made some minor changes referring to the apple method (adding “using terms…” and “on perform…”).
But when I invoke the rule with Mail ActOn it doesn’t do anything…what am I doing wrong?
using terms from application "Mail"
on perform mail action with messages theMessages
set messageList to {}
tell application "Mail"
set mailFolder to POSIX path of (path to library folder from user domain) & "Mail"
repeat with oneMessage in theMessages
set theID to (id of oneMessage as Unicode text) & ".emlx"
try
set messageLocation to do shell script "find " & quoted form of mailFolder & " -name " & theID
if messageLocation is not "" then set end of messageList to POSIX file messageLocation as alias
end try
end repeat
set newMessage to make new outgoing message with properties {subject:"theSubject", content:"theBody" & return & return}
tell newMessage
tell content
repeat with oneFile in messageList
make new attachment with properties {file name:oneFile} at after the last paragraph
end repeat
end tell
end tell
end tell
end perform mail action with messages
end using terms from
the problem is, creating an outgoing mail in a rule is broken in Leopard.
I wrote a work around in Code Exchange