Our nonprofit refurbishes used wheelchairs and then re-sells them real affordably to those who couldn’t otherwise afford them. We get a lot of our chairs because I request them from people who list them on Craigslist.
I click on the link for a wheelchair in Craigslist, which then opens an email in Eudora with all the info from the listing populated in it. Then I use applescript to reply to the email, ask them to donate their chair, and tell them about our nonprofit.
Recently I’ve had to upgrade to Mail.app and I can’t seem to figure out how to accomplish that in Mail. Safari creates a new email in Mail, but I can’t change/edit it with Applescript to tell people about our nonprofit and ask them to donate their chair. I’ve tried using the “source” of the new email to create a second new email but just can’t seem to get the syntax right. Any help would be appreciated.
Here’s what I’ve got so far. (I miss Eudora.)
tell application "Mail"
#I don't know how to even talk to the newly-created message
#tell message 0 of mailbox "Drafts" of account "Members" ?
tell last outgoing message
set EmailSubject to the subject
set EmailContent to the content
set SourceText to the source
end tell
#get their email from the source text
set StartText to offset of "To:" in SourceText
set SourceText to strings StartText thru -1 in SourceText
set EndText to offset of "
" in SourceText
set EndText to EndText - 1
set EmailTo to strings 5 thru EndText in SourceText
#Create the email
set TheOutgoingMessage to make new outgoing message with properties {subject:EmailSubject, content:"Info about our nonprofit and asking them for their chair."}
tell TheOutgoingMessage to make new to recipient at end of to recipients with properties {address:EmailTo}
end tell
Model: Mac Mini
AppleScript: 2.4
Browser: Safari 537.36 OPR/45.0.2552.888
Operating System: Mac OS X (10.10)