I’m getting data for the body of and email from Filemaker and using applescript to send it. Can AppleScript format the email, such as font, size, bold or even do HTML email?
Yes, it sure can.
I’m doing something similar. I get the data from an Excel sheet, pull HTML code from a text file and string it all together.
I control the fonts, etc with a .css file from our Web server.
It’s been a while since I wrote the script, but I’d bet I referenced the ScriptBuilders section and searched the BBS for some help.
If you want to go the HTML route, let me know and I’ll be glad to share the snippet of code that creates a message, sets the subject line, builds the body and then send off the EM.
Of course, you’ll have to promise that it’s not spam that you’re sending out.
I would be interested in looking at any examples you have. I’m using this for a customer’s receipt of an order and not spam.
Thanks
The code is even more simple than I remembered last night when I didn’t have it in front of me:
tell Application "Microsoft Entourage"
make new outgoing message with properties {recipient:EMaddress, subject:email_subject, content:email_content, has html:true}
set messID to the result
send messID
end tell
EMaddress, email_subject and email_content are the three variables I use (the e-mail name is pulled from Excel, as is the e-mail address. The subject is defined as a set command in the script itself and the email_content is a combination of other variables.
The rest of the script is used to pull the information from Excel as well as to build the content of the e-mail from both within the script, sometimes information from Excel and then from two text files containing code for the top and bottom of the “html” page. I won’t muck this post up with that code since you’ll be pulling from FileMaker.
It’s probably been years since I scripted FileMaker (I was using OS 9 at the time), but my recollection is that it was much easier that doing the same task in Excel.
My script is used to communicate with our students (I work at a community college) on a variety of topics. Recently, we were able to send them e-mails containing their specific registration date and time. Overall, not a huge leap of technology, but very significant for us.
I opted to use Entourage because it appeared to handle the task (especially of HTML) better than Mail, which is my normal e-mail client.