AppleMail: Sende Email als Attachment einer anderen…
12/02/2010on create_mail_emlx_files_attachment_of_selection()
tell application "Mail"
-- get the mail selection
set myMessages to selection
--do it to every selected mail
repeat with m in myMessages
--get the folder where the emlx file is stored in
set mypath to quoted form of POSIX path of ((account directory of account of mailbox of m) as alias)
--get the id of that message (should be unique within each account)
set myid to id of m
--find the folder where this unique email (by id) is stored in
set myfolder to quoted form of (paragraph 1 of (do shell script "find " & mypath & " -name '" & myid & "*.emlx*' -exec dirname {} \\;"))
--create a compressed tar archive of this message and open this gzipped files with Apple Mail (-> attach it to a new message).
do shell script "cd " & myfolder & ";tar -rf " & myid & ".tar " & myid & "*.emlx*;gzip " & myid & ".tar;mv " & myid & ".tar.gz /tmp/;open -a /Applications/Mail.app /tmp/" & myid & ".tar.gz"
end repeat
end tell
end create_mail_emlx_files_attachment_of_selection
on create_mail_source_attachment_of_selection()
tell application "Mail"
-- get the mail selection
set myMessages to selection
--do it to every selected mail
repeat with m in myMessages
set myid to id of m
set mysource to quoted form of ((source of m) as text)
do shell script "cd /tmp/;echo " & mysource & "|cat>/tmp/" & myid & ".txt;gzip " & myid & ".txt;open -a /Applications/Mail.app " & myid & ".txt.gz"
end repeat
end tell
end create_mail_source_attachment_of_selection