something about APPLE here: I am APPLE fans and like their products. By open this blog, I am not trying to BIAS toward APPLE company. Some of the fact below supported my decision. They introduced the computer MOUSE to the world. They changed the way we look at SMART Phone. They boosted up the use of 3G network. They were the first to use USB port as the main connection for computer system. They were the one who able to make a media centre to sync with every devices in your family. They made thing that work magically simple for us. Everything above and more to come... APPLE

Saturday, January 8, 2011

Script for send email with attachment

I found the script below and modified some of the field. It was a fail script when I ran it at the first time. Then I found out the "as alias" which placed after the attachment field is a must. As the script has to duplicate the object and paste into the email. I am going to automate the script to mail attachment on my desktop to this blog. Safari has an option to save picture on desktop. That is a common task for me to execute as I save image when I browse around the web. Will post it once I able to run it smoothly.



set theSubject to "new subject"
set theBody to "this is the message body"
set theSender to "Simon"
set theName to ""
set theAddress to "receiver email address"
set theAttachment to "Macintosh HD:Users:Desktop:raina.jpg" as alias

tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to true
set sender to theSender
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
tell content
make new attachment with properties {file name:theAttachment} at after the last paragraph
end tell
end tell
activate
end tell

No comments:

Post a Comment