using terms from application "Mail" on perform mail action with messages theMessages for rule theRule tell application "Mail"
repeat with eachMessage in theMessages set theText to content of eachMessage end repeat end tell
set uni8 to theText as «class utf8» set fileNum to open for access file "Macintosh HD:test.xml" with write permission write theText to fileNum close access fileNum