title: Get the Date of an Email via AppleScript
body: <p>I am currently trying to customize an AppleScript that is reading the unread Mails in the Inbox.
  That basically works fine except the fact, that I can#T manage to get the date of the mails.</p>
  
  <p>After  about 2 hours of googling around I found out that the Variable I need should be receivedate or deliverydate, but when trying to use one of these I get an error like this:</p>
  
  <pre><code>"...receivedate of id... cannot be converted to Type reference..."
  </code></pre>
  
  <p>Someone's got an Idea, how I can convert this?</p>
  
  <p>And this is my current code:</p>
  
  <pre><code>tell application "System Events"
      set processList to (name of every process)
  end tell
  if processList contains "Mail" then
  tell application "Mail"
      if (unread count of inbox) &gt; 0 then
          set messageList to (messages of inbox) whose read status is false
          set output to "Mails:" &amp; return &amp; return &amp; ""
          repeat with itemNum from 1 to (unread count of inbox)
              set itemDate to (receivedate of item itemNum of messageList)
              set output to output &amp; itemDate &amp; " - " &amp; (extract name from sender of item itemNum of messageList) &amp; return &amp; subject of item itemNum of messageList &amp; return &amp; return
          end repeat
      end if
  end tell
  else
  set output to "ÄpplMäil isch aus..."
  end if
  </code></pre>