AppleMail: Sende Email als Attachment einer anderen…

Ok, die Sinnfrage stelle ich mal nicht. Wenn jemand aber wie z.B. in Thunderbird eine Email nicht als Text, sondern die gesamte Email (Header inkl.) als Attachment verschicken möchte, der könnte eine dieser AppleScript-Funktionen nutzen, um das zu erreichen:
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

on 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

This entry was posted in Apple Mail and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA:


9 − = one

Subscribe without commenting

  • Seite übersetzen:


    Paypal for Pizza:




  • Kategorien


  • Letzte Kommentare

    • Niklas: Vielen Vielen Dank! So klappt es!
    • hubi: Servus Niklas, ich habe mir den Quellcode noch einmal angesehen und habe nun unter 10.7.3 einen Weg gefunden...
    • Niklas: Klingt super das Script. Leider bekomm ich immer folgende Fehlermeldung: error “„Mail“ hat einen Fehler...
    • Jürgen: Hallo Hubi, beim Abfragen von Kennworten gibt es noch eine böse Falle: Das Format, in dem security antwortet,...
    • hubi: Am einfachsten Du öffnest im AppleScript-Editor mal das Funktionsverzeichnis (unter Ablage) von iTunes. Ein...