• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Recipients in Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recipients in Mail.app


  • Subject: Re: Recipients in Mail.app
  • From: "Marc K. Myers" <email@hidden>
  • Date: Wed, 25 Jun 2003 12:37:16 -0400

At 9:43 pm -0400 24/6/03, Marc K. Myers wrote:

John Delacour wrote:

tell application "Mail"
set _message to make outgoing message with properties {visible:true}
tell _message
set r1 to {name:"me", address:"me@home"}
make to recipient at end with properties r1
end
end

I do hope they've replaced the team that is responsible for this mess.

I tried your code directly and I tried incorporating it into my script. In both cases I got the same result: no recipients in the message.

Well I'm using the same versions as you and it works fine here, so I have no idea what can be wrong. I've also just tried it again, just as written above, just to be sure, and it works.

Here's my code in it's entirety. Can you see anywhere that I've gone wrong?

-----
property theMsg : "This is the body of the message."
property theSubj : "Please come to the meeting on "
property theRecips : {"John Southworth <email@hidden>", ,
"Marc K. Myers <email@hidden>", ,
"Mycroft Holmes <email@hidden>"}

--on idle
set theDate to (current date)
set theDay to word 1 of (theDate as text)
set startDate to date (date string of (current date))
set theDiff to days - (theDate - startDate)

--if it's not Saturday, fire up 30 secs after midnight next day
--if theDay is not "Saturday" then return (theDiff + 30)

set subjLine to theSubj & formDate(startDate + 2 * days)

tell application "Mail"
set newMessage to make new outgoing message with properties ,
{visible:true, subject:subjLine, content:theMsg & return & return}
tell newMessage
set sender to "Marc K. Myers <email@hidden>"
set {od, AppleScript's text item delimiters} to ,
{AppleScript's text item delimiters, "<"}
repeat with aRecip in theRecips
set nameList to text items of aRecip
set theName to text 1 thru -2 of item 1 of nameList
set theAddress to "<" & item 2 of nameList
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
end repeat
set AppleScript's text item delimiters to od
--send newMessage
end tell
end tell
return theDiff + 30
--end idle


on formDate(theDate)
--get time 0 for the Unix side
set theEpoch to date (do shell script "date -r 0 +\"%a %b %e %Y %H:%M:%S\"")

--current time in seconds from time 0, as text (for next bit)
set theDiff to (theDate - theEpoch) as text

--convert the any scientific notation to an "integer" string
if theDiff contains "E" then
set thePower to (last character of theDiff) + 1
set theDiff to (first character of theDiff & (characters 3 thru -4 of theDiff as text))
repeat until (length of theDiff) = thePower
set theDiff to theDiff & "0"
end repeat
end if

--do the shell script
return (do shell script ("date -r " & theDiff & " +\"%D\""))
end formDate
-----

Everything looks right in the Event Log but for some reason the "To:" line doesn't get filled. I don't know if this is of any significance, but when I tried to set the subject and content properties of newMessage inside the tell to newMessage instead of in the "make new" line they weren't inserted either.

Maybe my copy of Mail.app is hosed? I can't figure out how to download a new copy from Apple or extract one from the Jaguar installation CD.

Marc [06/25/03 12:35:40 PM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Recipients in Mail.app
      • From: John Delacour <email@hidden>
References: 
 >Re: Recipients in Mail.app (From: John Delacour <email@hidden>)

  • Prev by Date: Re: Recipients in Mail.app
  • Next by Date: Re: Short, maybe even handy, Address Book script
  • Previous by thread: Re: Recipients in Mail.app
  • Next by thread: Re: Recipients in Mail.app
  • Index(es):
    • Date
    • Thread