Example of extracting information from a selected email in Apple’s Mail.app. There are many more if you look in the dictionary of Mail.
OS version: OS X
tell application "Mail"
set theSelectedMessage to selection
if (count of theSelectedMessage) is equal to 0 then
display dialog "Please select a message in Mail first, then run this script again."
else if (count of theSelectedMessage) is equal to 1 then
set thisMessage to item 1 of theSelectedMessage
set theBody to content of thisMessage
set theTargetText to paragraph 3 of theBody
set theSource to source of thisMessage
set theSubject to subject of thisMessage
set theSender to sender of thisMessage
set theId to message id of thisMessage
set theSize to message size of thisMessage
else
display dialog "Please select only one message in Mail first, then run this script again."
end if
end tell