• 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: I need help to customize email with AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I need help to customize email with AppleScript


  • Subject: Re: I need help to customize email with AppleScript
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 02 May 2014 15:49:43 -0500

On May 02, 2014, at 03:49, Anthony Femenia <email@hidden> wrote:
I want to open a mail window from Safari with the "email contents" command, but with pre-filled fields (cci, to, attachment and  signature).
______________________________________________________________________

Hey Anthony,

Unfortunately you can't.

Once a message has been created in Mail you can no longer manipulate it via AppleScript unless you resort to UI-Scripting with System Events.

This is Bizarro Apple in action and defies all reason, but there you go.  We've hounded them for years about this, the inability to set the selection, and a few other things - to little avail.

It's really strange in view of the fact that Mail is fairly scriptable.

You can do something like this with vanilla AppleScript:

-------------------------------------------------------------------------------------------

set toName to "John Smith"
set toAddress to "email@hidden"
set _sender to "Christopher Stone <email@hidden>"
set _subject to "Test Message"
set _body to "Now is the time for all good men to come to the aid of their country."
set _sig to "Take_Care"

tell application "Mail"
set _sig to signature _sig
set _msg to make new outgoing message with properties {subject:_subject, content:_body & return & return}

tell _msg

set visible to true
make new to recipient at end of to recipients with properties {name:toName, address:toAddress}
set sender to _sender
set message signature to _sig
end tell

activate

end tell

-------------------------------------------------------------------------------------------

If you want to fool with UI-Scripting try Googling this:

"system events" "mail" site:http://lists.apple.com/archives/applescript-users

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: I need help to customize email with AppleScript
      • From: Anthony Femenia <email@hidden>
References: 
 >Fwd: I need help to customize email with AppleScript (From: Anthony Femenia <email@hidden>)

  • Prev by Date: Re: Quicktime export permissions.
  • Next by Date: Re: Quicktime export permissions.
  • Previous by thread: Fwd: I need help to customize email with AppleScript
  • Next by thread: Re: I need help to customize email with AppleScript
  • Index(es):
    • Date
    • Thread