1 Reply Latest reply: Dec 5, 2008 6:23 PM by ericmeyers
reganyelcich Level 1 (15 points)

I have seen this mentioned/asked for a number of times but haven't been able to find a solution. Does anyone know if there is an applescript available that will print an email out of Mail?


Apple 17" Laptop, Dual G5 Xserve, Mac OS X (10.5.5)
  • ericmeyers Level 4 (1,410 points)
    Something like this ...

    tell application "Mail"
    set msg to the first message of mailbox "INBOX" of account "Google Mail (imap)"
    set theText to content of msg
    set theFile to ((path to desktop) as string) & "mailmsg.txt"
    set theFileID to open for access file theFile with write permission
    write theText to theFileID
    close access theFileID
    end tell

    tell application "TextEdit"
    set theFile to ((path to desktop) as string) & "mailmsg.txt"
    set newdoc to open (theFile as alias)
    print newdoc without print dialog
    close newdoc
    end tell