Benches macOS

1

Mail AppleScript - Print Email?

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hi

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?

Thanks,

Regan

1 reply

Sign in or join Beachball Help to reply.

  1. 0

    ericmeyers

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    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

    Eric