I have my customers fill out a form for their address online and it comes to me formatted as comma delimited (i.e., first, last, address, apt, city, state, zip). This is sent as the first paragraph of the email.
I want to be able save these out to a text file but only of the emails I select (or the ones that are Unread) so I can import the comma delimited text file into my address database in FileMaker Pro.
So far, I have this but it doesn’t work. I end up with just the last email paragraph in the text file. Can anyone give me a little guidance on how to make this work or, at least, tell me what I’m doing wrong?
property list_path : "/Users/User Name/Desktop/test.txt"
tell application "Mail" to try
repeat
tell message viewer 1 to set selected messages to {first message of beginning of (get selected mailboxes) whose read status is false}
set thisMessage to a reference to item 1 of (get selection)
tell thisMessage
set custAdd to paragraph 1 of content
end tell
end repeat
on error
beep
display dialog "You've reached the end of the list"
end try
do shell script ("echo '" & custAdd & "' >> '" & list_path & "'")
return custAdd