Applescripting AOL Mail

Has anyone had success Applescripting AOL mail? A search of archived Usenet postings reveals that a working script was once to be found in the archives here, but seems no longer to be available. Creating a new mail document and entering the subject line is very straightforward, as is actually sending the mail. My ultimate goal is a script to pull addresses and mail text from within a FMPro DB to compose AOL mail, including a file attachment.

The snippet below works fine, but of course generates an error since there is no recipient specified. Any help from wiser heads than mine would be appreciated.

tell application "America Online"
set docname to "Any Subject"
set recip to "mail@somewhere.com"
make new document with properties {kind:mail, name:docname}
SendLetter document docname 
end tell

Hi folks,
Here’s what I’d like to find an AppleScript for – fighting spam. My AOL account is almost unusable; AOL tries to fight spammers by advising users to forward email to a special address which AOL uses to attempt to filter/manage spammers. Unfortunately, AOL’s unsophisticated email client doesn’ allow one to simple select several messages and forward them en masse, and here’s where my fantasy AS comes into play – does anyone know of an existing script, or how to make a script that would allow one to select and then forward AOL messages to this tosspam account?
Much thanks!
-Lewis

Not sure what you’re asking for, but since I have a more elaborate script available than yours, I’ll just post it here for you to use as needed. This script can set the to, cc, and bcc fields, as well as adding an attachment. After sending, it closes the document as well.

Hope this helps. Enjoy.

tell application "America Online"
	set toList to {"TOSEmail"}
	set ccList to {"stevecasetheking", "stevecaselordofeverything@aol.com"}
	set bccList to {"steveswife"}
	set mailSubject to "Harassment"
	set mailMessage to "Dear All:" & return & return & "User 'stevecase' was harassing me." & return & return & "Thanks, Bill G."
	--set mailAttachment to "Macintosh HD:File to Send.txt"
	set documentRef to make new document with properties {kind:mail}
	set mailref to mailer of documentRef
	set text of documentRef to mailMessage
	set subject of mailer of documentRef to mailSubject
	repeat with mailRecipient in toList
		make new addressee at end of mailref with properties {kind:regular, name:mailRecipient}
	end repeat
	repeat with mailRecipient in ccList
		make new addressee at end of mailref with properties {kind:cc, name:mailRecipient}
	end repeat
	repeat with mailRecipient in bccList
		make new addressee at end of mailref with properties {kind:bcc, name:mailRecipient}
	end repeat
	make new attachment at end of docref with properties {local file:mailAttachment}
	SendLetter documentRef
	close documentRef saving no
end tell

Thanks very much for the script. I did find a mail script as a download on AOL’s Applescript board (amazingly); however, the one you’ve posted is much more complete and useful. The one I found follows below, in case anyone’s interested:

set emailsub to text returned of ¬
(display dialog "Please Enter E-mail subject:" default answer "") set emailrecvr to text returned of ¬
(display dialog "Please enter Email address or screen name of receiver" default answer "") set emailmsg to text returned of ¬
(display dialog "Please enter email message:" default answer "")
tell application "America Online"
activate
set x to make new document with properties {kind:mail, name:emailsub}
set text of x to emailmsg
tell first mailer of x
set subject to emailsub
make new addressee with properties {name:emailrecvr, kind:regular} at beginning
--make new addressee with properties {name:"CC adressee", kind:cc} at beginning
--make new addressee with properties {name:"adressee", kind:regular} at beginning
end tell
SendLetter x 
end tell

(AOL Email example Kenneth Durrum 1999 AOL 4.0)