Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > AppleScript Mail Script

AppleScript Mail Script
Thread Tools
Fresh-Faced Recruit
Join Date: Aug 2002
Location: Portland, OR
Status: Offline
Reply With Quote
Dec 4, 2003, 12:10 AM
 
My brother in law comes over to my house during the day while I'm at work to visit with our puppy and use my computer. This is great because my wife and I are teachers and work 10+ hrs every day unless I need to let my dog out. We've asked him to e-mail us work when he comes over, but he "forgets".

So, I want an applescript that will run when he logs into my computer to send me an automated e-mail. I've tinkered a bit, but not gotten anything to work. Anybody have such a script or have some good advice on how to write one?

I am a very novice applescripter. Very novice.

BRS
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Dec 4, 2003, 04:50 AM
 
Code:
tell application "Mail" (* SPECIFY GENERAL CONTENT OF MESSAGE *) set bodyvar to return & return & "Test body." set addrVar to "bogus@apple.com" set addrNameVar to "Guinea Pig" (* DEFINE THE SUBJECT LINE *) set subjectvar to "Test Message From AppleScript!" (* CREATE THE MESSAGE *) set composeMessage to (a reference to (make new outgoing message at beginning of outgoing messages)) tell composeMessage make new to recipient at beginning of to recipients ¬ with properties {address:addrVar, name:addrNameVar} set the subject to subjectvar set the content to bodyvar end tell (* SEND THE MESSAGE *) send composeMessage end tell
You know it makes sense. ☼ ☼ ☼ Growl.
     
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Dec 5, 2003, 12:37 PM
 
Diggory's script will open Mail and send an e-mail. You need to save it as an application and put it in his login items if you want it to send every time he logs in. Just FYI, because it opens Mail, it is not transparent to the user. This shouldn't matter in your situation though since he knows he's supposed to send the mail, he just forgets. This way he doesn't have to remember. But there are ways to send the mail without him even knowing it. It requires an extra AppleScript scripting addition or a command line solution.
(Last edited by Xeo; Dec 5, 2003 at 12:42 PM. )
     
Fresh-Faced Recruit
Join Date: Aug 2002
Location: Portland, OR
Status: Offline
Reply With Quote
Dec 5, 2003, 05:23 PM
 
Do you know a transparent version too? It appears as though he defeated the script yesterday - not sure why... When I test it, it works every time (i.e., whenever I log in as him, it sends off an e-mail to my work address. But, yesterday, it didn't work (and I know he logged in).

Thanks again,

BRS

Originally posted by Xeo:
Diggory's script will open Mail and send an e-mail. You need to save it as an application and put it in his login items if you want it to send every time he logs in. Just FYI, because it opens Mail, it is not transparent to the user. This shouldn't matter in your situation though since he knows he's supposed to send the mail, he just forgets. This way he doesn't have to remember. But there are ways to send the mail without him even knowing it. It requires an extra AppleScript scripting addition or a command line solution.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:50 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2