Make an email body into a text file?

Discussion in 'macOS' started by dvkid, Jun 25, 2008.

  1. dvkid macrumors regular

    Feb 18, 2006
    I want to make an AppleScript that takes the body the selected email message and turns it into a text file (XML). The email body will already bare all necessary XML formatting. The script would literally emulate copying the body and pasting it into TextEdit and doing a Save As with extension XML. I could easily build a Script or Automation that takes the clipboard but haven't found a way to capture the body of the selected email.

    Anybody know?
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    This AppleScript will grab the content of the 1st selected message into a variable. What you do with it then is up to you

    tell application "Mail"
    	set theSelectedMessages to selection
    	set the selectedMessage to item 1 of theSelectedMessages
    	set myContent to content of selectedMessage
    end tell

Share This Page